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

Re: Efficiency in maintenance coding...

by runrig (Abbot)
on Nov 15, 2001 at 05:08 UTC ( [id://125479]=note: print w/replies, xml ) Need Help??


in reply to Efficiency in maintenance coding...

If someone's going to maintain perl, I expect them to know or learn what operators like '<>' are, and that you can have statement modifiers, and that there's a '$_' variable, and that this is a whole lot more maintainable (fixing your bug, but not spelling out everything quite as much as tilly did above):
# Count words in files or STDIN my %frequency; while (<>) { $frequency{$1}++ while /(\w+)/g; } print "$_: $frequency{$_}\n" for sort keys %frequency;

Log In?
Username:
Password:

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

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

    No recent polls found