in reply to Re: Array got modified!
in thread Array got modified!
O!! Thx man! This explains a lot. Never notice for yrs.
So I am gonna change my habit to do this way :
So I am gonna change my habit to do this way :
Would you suggest which one is better, or any well suggested practice?@arr = qw/Foo Bar Blaz/; foreach ( @arr ) { my $ele = $_; $ele =~ s/^(.)/x$1/; } # or this while ( my $ele = <@arr> ) { $ele =~ s/^(.)/x$1/; } print "@arr"; # still 'Foo Bar Blaz'
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Array got modified!
by Jenda (Abbot) on Oct 10, 2011 at 10:25 UTC | |
by exilepanda (Friar) on Oct 10, 2011 at 12:51 UTC | |
by Anonymous Monk on Oct 10, 2011 at 13:00 UTC | |
by exilepanda (Friar) on Oct 10, 2011 at 13:19 UTC | |
by Anonymous Monk on Oct 10, 2011 at 13:21 UTC | |
by choroba (Cardinal) on Oct 10, 2011 at 13:44 UTC | |
by exilepanda (Friar) on Oct 10, 2011 at 16:03 UTC | |
Re^3: Array got modified!
by BrowserUk (Patriarch) on Oct 10, 2011 at 03:36 UTC | |
by exilepanda (Friar) on Oct 10, 2011 at 03:54 UTC | |
Re^3: Array got modified!
by choroba (Cardinal) on Oct 10, 2011 at 07:31 UTC |
In Section
Seekers of Perl Wisdom