#! perl -lw use strict; ## Note the -l above which makes print add newlines. open IN, '<:raw:perlio', $ARGV[0] or die $!; open OUT, '>', 'junk.out' or die $!; $/ = \16; ## read 16 bytes at a time; print join ',', map{ sprintf '0x%04x', $_ } unpack 'v*', $_ while ; close OUT; close IN; #### perl -nle"BEGIN{$/=\16}print join',',map{sprintf'0x%04x',$_}unpack'v*',$_" binfile >outfile