Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: Scoping of my with foreach loop

by ikegami (Patriarch)
on Mar 07, 2005 at 19:33 UTC ( [id://437294]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use strict;
    my @values = (1, 2, 3, 'a', 4);
    ...
        last if $item =~ /[^\d]/;
    }
    print($item);  # Prints 'z', not 'a'.
    
  2. or download this
    use strict;
    
    ...
    
    # Changing "my $item" to "our $item"
    # changes the output to "[1][2][3][a]z"
    
  3. or download this
    This is perl, v5.6.1 built for MSWin32-x86-multi-thread
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-03-19 04:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found