in reply to Perl Syntax/resources that we generally don't know or forget.
Lvalue substr() is my special friend. Did you know you can bind regular expressions and transliterations to them?
my $x = "x" x 50; substr($x, 12, 34) =~ tr[x][y];
Foreach's iterator variable is an alias for an item in the list being iterated through. This works with values() and hash slices, too.
my %x = (a=>1, b=>2, c=>3); $_ *= 2 foreach values %x;
I'm so, so easily amused. :)
-- Rocco Caputo - rcaputo@pobox.com - poe.perl.org
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
•Re: Re: Perl Syntax that we generally don't know or forget.
by merlyn (Sage) on Jan 18, 2004 at 13:13 UTC | |
by shotgunefx (Parson) on Jan 18, 2004 at 18:15 UTC | |
by ysth (Canon) on Jan 19, 2004 at 02:12 UTC | |
|
substr() as an lvalue
by ambrus (Abbot) on Jan 19, 2004 at 11:37 UTC |