Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
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 rifling through the Monastery: (9)
As of 2014-12-26 19:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (174 votes), past polls