[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Commenting blocks of code



Larry Moore <ljmoore@freespace.net> writes:

>(this passes simple testing, deleting non-uniq lines from a sorted text file)
>uniq.pl
>$saved = "";
>while ( <> )
>{ if ($saved ne $_ )
>	{
>	print $_
>	};
> $saved = $_;
> }

uniq(1), a popular (okay, probably NOT popular, but universally installed 
anyway) Unix utility can be implemented in a single line of Perl, as was 
discussed last November on the BBEdit-Talk mailing list:

http://search.barebones.com/action.lasso?-database=lists.fp3&-layout=import
&-response=%2ftalk%5flists%2fdetail.html&-recid=45128&-search

However, this involves use of -e in the #! line, which won't actually 
WORK in MacPerl.

The closest I got is found in the above referenced post, but if you're 
too lazy to look:

#!perl -nl
print unless $s{$_}++

This WAS last November, and of such little consequence at the time, that 
I didn't even save a copy of the code.  You might try Terje Bless' 
version (NOW you must reference the above post!) in MPW Perl, or using 
Toolserver.  As a one-liner it fails because there's no input file.

--B

Brian McNett, Webmaster
*************************************************************
Mycoinfo. The world's first mycology e-journal.
http://www.mycoinfo.com/
*************************************************************


# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org