Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^2: divide one file into multiple arrays

by Eily (Monsignor)
on Jun 25, 2013 at 20:52 UTC ( #1040655=note: print w/replies, xml ) Need Help??


in reply to Re: divide one file into multiple arrays
in thread divide one file into multiple arrays

I'll have to remember to upvote that one when I get a new load of votes :).

You can make the bad_hash straightaway with map :

my %isBad= map { $_ => 1 } qw/ www.yahoo.com www.google.com www.comcast.com /;
Which would be   my %isBad = map { $_ => 1 } @sites; for tevus_oriley. And with the hash values being 1, you can just write if ( $isBad{$www} ) instead of if (exists $isBad{$www})

Edit : Whoops, posted too fast, chomp returns the number of chomped elements, not the chomped list.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2022-09-26 16:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer my indexes to start at:




    Results (117 votes). Check out past polls.

    Notices?