Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Looking for pointers or optimizations.

by aaron_baugher (Curate)
on Aug 21, 2012 at 13:52 UTC ( [id://988736]=note: print w/replies, xml ) Need Help??


in reply to Looking for pointers or optimizations.

You have some strange things going on at the top of your file. Comments interspersed:

my $words_file = @ARGV; # Evaluating an array in scalar context returns the length # of the array. So if you are passing your script one filename, # $words_file will equal '1', not the first argument from the # command line. Pass it two filenames, and it will equal 2, etc. # But that doesn't matter, because of another bug: open (my $fh, ">", $words_file); # Here you open the file for writing, but never use it. # (You should also check for errors, or use autodie.) my @words; while (<>) { push(@words, $_); } # Which turns out also not to matter, because you then use # the <> operator, which reads from the files in @ARGV # automagically. So lines 4 & 5 (the first two I quoted), # though broken, don't affect anything else, and could be # discarded.

Aaron B.
Available for small or large Perl jobs; see my home node.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2024-03-28 20:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found