
fashimpaur
User
May 9, 2002, 7:28 AM
Post #2 of 2
(1905 views)
|
|
Re: [Nieljk] newbie urgent trouble
[In reply to]
|
Can't Post
|
|
Nieljk, Here is my solution: # YOUR CODE : #open (FILE, $filename) #or die "File in storage could not be opened, check to see if it exists"; # # #@peps = <FILE>; #print "$filename\n\n"; #print @peps; #$peps = join( '', @peps); #$peps =~ s/\s//g; # #unless ($peps =~ m/ kr | kp | KR | KP /){ #$peps =~ s/r\/r\n//g; #} # Modify your code to look like this: # uncomment next 2 lines #sub perform_a_protein_digest { #open (FILE, $filename) or die "File in storage could not be opened, check to see if it exists"; # comment out next line @peps = <DATA>; # uncomment next 2 lines #@peps = <FILE>; #close FILE; print "$filename\n\n"; print @peps; $peps = join( '', @peps); $peps =~ s/\s//g; $peps =~ s/(k|r)(?!p)/\n/gi; print $peps; # These lines were unnecessary #@peps = split( '',$peps); #print @peps; # uncomment next block for use in your subroutine #print "Please enter the name of the file you wish to write the results to:\n\n"; #$writefile = <STDIN>; #chomp $writefile; #open (OPENFILE, ">$writefile"); # OPENS A FILE TO BR WRITTEN TOO. #print OPENFILE @peps; #close(OPENFILE); #CLOSES THE FILE THAT WAS WRITTEN TOO #print "File Saved Successfully!\n"; #} __DATA__ rkfjsnrevkjnaesveiw weciywubecuyweij rkmwefkpwewcewe
Added Output Here: rkfjsnrevkjnaesveiw weciywubecuyweij rkmwefkpwewcewe fjsn ev jnaesveiwweciywubecuyweij mwefkpwewcewe
Also, fixed regex. First solution display was from wrong copy of test script. This one works. Let me know if I misunderstood the requirements. Dennis $a="c323745335d3221214b364d545". "a362532582521254c3640504c3729". "2f493759214b3635554c3040606a0", print unpack"u*",pack "h*",$a,"\n\n";
(This post was edited by fashimpaur on May 9, 2002, 8:12 AM)
|