Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
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 wandering the Monastery: (8)
As of 2014-10-23 00:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (123 votes), past polls