#!/usr/bin/perl -w use strict; use warnings; open ('CSV','<',$file); while (){ $counter++; @fields = split ",",$_; my($ndx); foreach $ndx (0 .. (0 + @fields -1)){ $fields[$ndx] =~ s/\s*$//g; $fields[$ndx] =~ s/'/\\'/g; $fields[$ndx] =~ s/"//g; if($ndx == 32){ print STDERR "For field $ndx, the value is now: |$fields[$ndx]| \n"; my @chars = split(//, $fields[$ndx]); foreach my $chr (@chars) { print STDERR '|' . ord($chr) . '|,'; } print STDERR "\n"; } } close('CSV');