> -----Original Message-----
> From: Rupert Heesom [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 10, 2002 10:18 AM
> To: [EMAIL PROTECTED]
> Subject: Easy way to compare 2 perl lists (arrays)?
> 
> 
> I'm working with directories in which there should be a 
> number of graphs
> files; one TIFF file, one PDF file.
> 
> I'm wanting to find which TIFF files there is no 
> corresponding PDF file for.
> 
> One way to do this is to create 2 lists (arrays), one for all 
> the TIFF files
> in a directory, the other list for all the PDF files in the 
> same directory.
> Then to compare the 2 lists to find the missing PDF files.
> 
> However, if there is a better way to do this (I'm new to 
> Perl), can anyone
> let me know?

A one-liner like the following will print the names of the 
missing .pdf files:

$ perl -le 'print $_ for grep { s/\.tiff$/.pdf/ && !-f } @ARGV' *.tiff

Only one array is needed if you just want to compare in one direction.

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

Reply via email to