Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^3: 'Dynamic scoping' of capture variables ($1, $2, etc.)

by LanX (Canon)
on Dec 16, 2012 at 22:48 UTC ( #1009098=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use warnings;
    use strict;
    ...
     
    $x='abc';
    say del1();                              # => "abcxcba"
    
  2. or download this
      DB<105> sub delchar { my $m; $m = $1 if $x =~ s/(\w)//;  $m ?  $m . 
    +delchar() . $m : "-"  }
     => 0
    ...
     
      DB<108> $x='abc'; delchar()
     => "abc-cba"
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (8)
As of 2015-07-04 16:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls