Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^2: Perl substitution not working

by muba (Priest)
on Jun 21, 2012 at 00:53 UTC ( #977525=note: print w/replies, xml ) Need Help??


in reply to Re: Perl substitution not working
in thread Perl substitution not working

The actual reason you aren't substituting properly is that you are printing @L1, but that array never gets modified by your substitution which acts on $line.

Not true:

my @L1 = qw(Abc aBc abC); for my $line (@L1) { $line =~ s/a/_/i; print "\@L1: <", join(", ", @L1), ">; \$line: <$line>\n"; } __END__ @L1: <_bc, aBc, abC>; $line: <_bc> @L1: <_bc, _Bc, abC>; $line: <_Bc> @L1: <_bc, _Bc, _bC>; $line: <_bC>

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://977525]
help
Chatterbox?
[robby_dobby]: shmem:everything2
robby_dobby says Sorry and points to his boredom
[shmem]: robby_dobby: since everything is everything, it is thus also everything2. And everything2 is based on... you name it.
[Corion]: Mhhmmm. I just had to remind two contractos of their priorities from my point of view. This felt somewhat like getting my godson+siblings to clean their room, including the evil eye I threw them ;)

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (14)
As of 2017-04-25 13:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (454 votes). Check out past polls.