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

Re: Binding within a sub

by Eily (Monsignor)
on Apr 18, 2018 at 08:04 UTC ( #1213107=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    for my $text ( qw( one two three four five six seven eight nine ten ) 
    +)
    {
      my $uniq_text = $text; # Copy
      ... # Your code, where $uniq_text is a new variable that was never u
    +sed before, and noone else has access to.
    }
    
  2. or download this
    sub InitializeList {
      my @items; # no need to undef it
      for my $text ( qw( one two three four five six seven eight nine ten 
    +) )
    ...
    }
    
    my @res = InitializeList(); # get the items from that call
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2020-11-26 21:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?