Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

why need my in a foreach loop?

by szabgab (Priest)
on Nov 28, 2010 at 04:36 UTC ( #874062=perlquestion: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use strict;
    use 5.010;
    ...
    foreach my $word (qw(abc def ghi)) {
       say $word;
    }
    
  2. or download this
    use strict;
    use 5.010;
    ...
       say $word;
    }
    say $word;  # word is "hello" here
    
  3. or download this
    use strict;
    use 5.010;
    ...
       say $word;
    }
    # generate syntax error if $word is used here
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2014-11-26 07:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (163 votes), past polls