note
Ovid
Well, heck. If we're gonna go that route, may as well golfuscate it:
<code>
sub my_chomp { substr shift, 0, (length) - 1 if $_[0] =~ /\n$/}; # :-)</code>
<P>
Cheers,<br>
<a href="/index.pl?node=Ovid&lastnode_id=1072">Ovid</a>
<P>
<strong>Update:</strong> Can anyone tell that I am *seriously* bored at work?
<code>
sub my_chomp { wantarray ? (map{ /\n$/ ? substr $_, 0, (length)-1 : $_ } @_)
: chomp(my $x = shift),$x };
</code>
That ugly hack will work for both arrays and scalars (I think). I noticed that it appears to be returning an empty element at the end of the array, though. :(
<P>
<FONT SIZE=1>Join the <A HREF="http://setiathome.ssl.berkeley.edu/stats/team/team_86606.html">Perlmonks Setiathome Group</A> or just click on the the link and check out our stats.</FONT>
50578
50598