thor has asked for the wisdom of the Perl Monks concerning the following question:
I thought that explicitly supplying the indicies for the array would help, but no dice. Is there some clever way to pull this off?use strict; use warnings; my $string = join('x', 'a'x20); my (@foo, $foo); (@foo[0..18], $foo) = split('x', $string); print "Success!\n" if $foo eq "a";
thor
Feel the white light, the light within
Be your own disciple, fan the sparks of will
For all of us waiting, your kingdom will come
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Is there any way to make an array non-greedy?
by ikegami (Patriarch) on Oct 14, 2005 at 16:56 UTC | |
by thor (Priest) on Oct 14, 2005 at 18:25 UTC | |
by duff (Parson) on Oct 15, 2005 at 03:56 UTC | |
Re: Is there any way to make an array non-greedy?
by sk (Curate) on Oct 14, 2005 at 16:53 UTC | |
Re: Is there any way to make an array non-greedy?
by xdg (Monsignor) on Oct 14, 2005 at 17:00 UTC | |
Re: Is there any way to make an array non-greedy?
by nothingmuch (Priest) on Oct 15, 2005 at 03:50 UTC | |
Re: Is there any way to make an array non-greedy?
by Anonymous Monk on Oct 14, 2005 at 16:54 UTC |