Jess Balint wrote:
> 
> Thank you for the advice.
> 
> > > open( STATES, "sort $hotline  |" )
> > >         or cust_die( "Cannot open files to get states
> > > ($hotline,$newtofile,$newmover): $!\n" );
> >
> > What does the $hotline variable contain?  Is there any reason
> > to use an external sort instead of perl's built-in sort?
> 
> I actually have three files where now:
> 
> "cat $hotline $newtofile $newmover | sed 's/\|.*//' | sort | uniq |"

There is no reason to fork external processes when you can do the whole
thing in perl.

open IN1, $hotline   or die "Cannot open $hotline: $!";
open IN2, $newtofile or die "Cannot open $newtofile: $!";
open IN3, $newmover  or die "Cannot open $newmover: $!";

my %seen;
for ( sort grep { !$seen{$_}++ } grep { s/\|.*// } <IN1>, <IN2>, <IN3> )
{
    # Recode missing
    push @states, /^$/ ? '(blank)' : $_;
    }



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to