Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: Perl substitution not working

by muba (Priest)
on Jun 21, 2012 at 00:53 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://977525]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-03-19 10:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found