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

Re: New to Perl

by jrtayloriv (Pilgrim)
on Jun 23, 2010 at 21:05 UTC ( [id://846176]=note: print w/replies, xml ) Need Help??


in reply to New to Perl

Also, if you are trying to grab lines based on the number of fields, you could do:

do_something_with($line) if (@{[split / /, $line]} == 3);

... to grab all of the lines that have 3 fields in them.

The following is a little faster, but throws a warning:

do_something_with($line) if ((scalar split / /, $line) == 3);

Of course, if you are looking at more than the number of fields, these won't be useful ...
--jrtayloriv

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-04-24 04:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found