-- Josh Goldberg <[EMAIL PROTECTED]>
On Wed, 20 Nov 2002 [EMAIL PROTECTED] wrote:
join ', ', grep{ ($b.=$_) !~ /.{91}/ || ?.? && ($_ = 'etc.') } @names
that didn't work in my test, but it gave me an idea with map. I know, I
used goto, but when I try to break from the BLOCK it says i'm not really
in a block inside map, even when I set it up as a block like the POD
shows.
@names = (
'foo',
'bar',
'baz',
'boo',
'zor',
);
$lim = 2;
$i=0;
map{$i++<$lim?push @n,$_:$i!=$lim?{push @n,'etc.' and goto FOO}:''}@names;
FOO:
$names = join ', ',@n;
print "Names: $names\n";
Why waste a map if you aren't using the return? This would
probably be clearer as a for loop.
--
Steven Lembark 2930 W. Palmer
Workhorse Computing Chicago, IL 60647
+1 800 762 1582