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

RE: [MacPerl] perl to c/c+/c



Your manager is right, if the code is ever to be ported.

Here is what I would do in perl:

%list = ();

open( IN, "< list.txt" ) || die...;
while ( <IN> )
	{
	chop;
	$list{$_} = 1;
	}
close( IN );

open (in2, ">file.lst");
oreach $id ( sort keys %list )
	{
	print ( in2 $id, "\n" );
	}
close (in2);

Any duplicates will result in setting the same hash value, which
performs the "uniq" part of your unix command, and the "sort keys"
gives you the sorted result of the uniq-ified values.

tim.


***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch