Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^9: Listing of files using glob

by AG87 (Acolyte)
on Jan 06, 2012 at 05:16 UTC ( #946526=note: print w/ replies, xml ) Need Help??


in reply to Re^8: Listing of files using glob
in thread Listing of files using glob

The input data is like

>1elwA AAAAAASSSSSSSSSSSSSSDDDDDDDDDDDFFFFFFFFFF >1flwA GGGGGGGGGGHHHHHHHHHHHHIIIIIIIIIIIIIIJJJJJJJJJJ >1ghwA KKKKKKKKKKLLLLLLLLLLMMMMMMMMMMNNNNNNNNNNOOOOO

Where >1elwA, >1flwA, >1ghwA should be the keys of the hashes and the respective data should be the value of the hash. The code/sub for storing in the file is

#!/usr/bin/perl my %seqInfo = (); open(FILE, 'test.fasta'); { while(<FILE>) { my $line = $_; if ($line =~ />.*/) { #print "$&\n"; } else { #print "$line\n"; } $seqInfo{$&} = $line; print "$& => $line\n"; } }

and the output is

=> >1elwA => AAAAAASSSSSSSSSSSSSSDDDDDDDDDDDFFFFFFFFFF => >1flwA => GGGGGGGGGGHHHHHHHHHHHHIIIIIIIIIIIIIIJJJJJJJJJJ => >1ghwA => KKKKKKKKKKLLLLLLLLLLMMMMMMMMMMNNNNNNNNNNOOOOO

However according to my understanding the output should be like

>1elwA => AAAAAASSSSSSSSSSSSSSDDDDDDDDDDDFFFFFFFFFF

Maybe the file is not properly stored as keys and values :( :(


Comment on Re^9: Listing of files using glob
Select or Download Code
Replies are listed 'Best First'.
Re^10: Listing of files using glob
by AG87 (Acolyte) on Jan 06, 2012 at 08:54 UTC

    Thankyou for the replies, Infact I have figured out the problem and have solved it. I have added a counter in it and its working fine + I have replaced the $& character with the similar substr expression as advised. So now the code is working fine. Thanks again for all the replies... :) :) :)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://946526]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2015-08-01 02:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (285 votes), past polls