#!/usr/local/bin/perl # # use strict; use warnings; use charnames qw( :full ); my @segment_array; #use File::BOM(); #this tells script to use the Byte Order Mark in reading the files, but it is not on the system I am using my $file_segment_name = "TestFile1.svd"; # examining the file in hex, it is utf8 encoded, with a Byte order Marker set at FFFE #read the files # open (FH_SEGMENT_FILE, "< $file_segment_name") || ERROR('open', 'segment file'); # open (FH_SEGMENT_FILE, '<:encoding(UTF16-LE)', $file_segment_name) || ERROR('open', 'segment file'); # open (FH_SEGMENT_FILE, '<:raw:perlio:encoding(UTF16-LE):crlf', $file_segment_name) || ERROR('open', 'segment file'); open (FH_SEGMENT_FILE, '< $file_segment_name' )|| ERROR('open', 'segment file'); # binmode (FH_SEGMENT_FILE, '<:crlf: encoding(UTF16-LE) ' ); # open (FH_SEGMENT_FILE, '<:raw:crlf: encoding(UTF16-LE) ', $file_segment_name ); # open (FH_SEGMENT_FILE, '< :crlf :encoding(UTF16)', $file_segment_name); @segment_array=; close(FH_SEGMENT_FILE); #print the file - it prints correctly print "@segment_array"; print "\n\n"; #put some spaces in for (my $i = 1; $i <=20 ; $i++){ my $segment_array= shift(@segment_array);; print "$segment_array[$i]"; } exit; #subs below this point #************************ #------------------------- sub ERROR () { print "Sever can't $_[0] the $_[1] \n"; } #----------------------------