Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: How can I get the results in a text file from counting in a string?

by Kenosis (Priest)
on Aug 07, 2012 at 19:16 UTC ( #986061=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use Modern::Perl;
    
    ...
    say $fh "Position of $positions{$_} ends at $_"
      for sort { $a <=> $b } keys %positions;
    close $fh;
    
  2. or download this
    Position of A ends at 2
    Position of T ends at 3
    ...
    Position of T ends at 9
    Position of A ends at 13
    Position of T ends at 14
    
  3. or download this
    use Modern::Perl;
    use Sort::Naturally;
    ...
    open my $fh, '>', 'Results.txt' or die $!;
    say $fh "$_ ends at $positions{$_}" for nsort keys %positions;
    close $fh;
    
  4. or download this
    A=1 ends at 2
    A=2 ends at 5
    ...
    T=2 ends at 6
    T=3 ends at 9
    T=4 ends at 14
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (7)
As of 2015-07-01 23:18 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 (24 votes), past polls