Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: Convert from awk to perl

by philipbailey (Chaplain)
on Jul 19, 2008 at 11:50 UTC ( #698803=note: print w/ replies, xml ) Need Help??


in reply to Re: Convert from awk to perl
in thread Convert from awk to perl

That won't quite work--braces, {}, are always required for blocks in Perl. So, for instance, the first "if" statement would need to be written as:

if ( substr($F[2],0,3) eq "eth" ) { $process=1; }
Update: Or to be a bit more "Perlish" you could write:
$process=1 if (substr($F[2],0,3) eq "eth");
Update 2: Correction of string comparisons, as per Anonymous Monk.


Comment on Re^2: Convert from awk to perl
Select or Download Code
Re^3: Convert from awk to perl
by Anonymous Monk on Jul 19, 2008 at 12:05 UTC
    strings are compared with eq, numbers with ==

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2014-07-14 02:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (254 votes), past polls