#! /usr/bin/perl open IN, "<", "abc.gif" or die "Unable to open input file: $!\n"; binmode IN ; local $/ ; $image = ; close IN ; open OUT, ">", "test.jpg" ; or die "Unable to open output file: $!\n"; binmode OUT ; print OUT $image ; close OUT ; #### #! /usr/bin/perl open IN, "<", "abc.gif" or die "Unable to open input file: $!\n"; binmode IN ; open OUT, ">", "test.jpg" ; or die "Unable to open output file: $!\n"; binmode OUT ; local $/ = \1024; # Read in 1024 byte blocks. print OUT $_ while ; close IN ; close OUT ;