John wrote:

> I want to test if a file is a gif image or not.

print "filename to check: ";
my $filename = <STDIN>;
chomp $filename;
open IN, $filename or die "Could not open file to check specs: $!";
binmode IN;
my $gif_label;
read (IN, $gif_label, 6);
chomp $gif_label;
if ($gif_label =~ /^GIF8[79]a/) {
   print "itsa GIF!";
} else {
   print"No, its not.  Sorry\n";
}

> Is it practicable using a module?

Uh, yeah.  Sorta takes the fun out of it, though.

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to