in reply to extract jpg from binary file
Assuming you have the memory, you can do:
my $jpeg = $binary_data; substr($jpeg, 0, index($jpeg, "\xFF\xD8") - 1) = ""; substr($jpeg, index($jpeg, "\xFF\xD9") + 1) = ""; [download]