Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
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 ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://986061]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-26 08:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found