in reply to if modifier of a print statement
my @test = qw(no_proc line_to_proc1 line_to_proc2); foreach (@test) { # this is actually just one line, indented to # make the if/else more clear. The trailing ";" # isn't even necessary. # this looks like a simple "we do either a or b, # but we will do one of them for sure situation, # ie if/else. The single statement below probably # equates to exactly the same machine code as a # more lengthy if/else statement. There is no # "next", there is no "and". /no_proc/ ? print "$_\n" : print "$_ : in proc\n" ; } __END__ prints: no_proc line_to_proc1 : in proc line_to_proc2 : in proc
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: if modifier of a print statement
by jwkrahn (Abbot) on Jun 30, 2009 at 12:14 UTC | |
by Marshall (Canon) on Jun 30, 2009 at 12:34 UTC | |
by jwkrahn (Abbot) on Jun 30, 2009 at 13:38 UTC | |
by Marshall (Canon) on Jun 30, 2009 at 15:58 UTC | |
by JavaFan (Canon) on Jul 01, 2009 at 09:58 UTC |