I double checked the code and haven't found any typo:
#!/usr/bin/perl $file = @ARGV[0]; $out_file = $file.".out"; my $count = 0; print "Processing file: $file\n"; print "Output file: $out_file\n"; open FILE, "$file" or die "cannot open $file file"; open OUT, ">>$out_file" or die "cannot create $out_file file"; #go through the file rows while (<FILE>) { chomp; # if row contain non-ASCII symbols - it is counted if ($_ =~ /[[:^ascii:]]/) { print "String before modification:\n $_ \n"; s/[[:^ascii:]]/q{<} . unpack(q{H2}, $1) . q{>}/eg; print "String after modification:\n $_ \n"; print OUT "$_\n"; $count++ ; } else { print OUT "$_\n"; } } print "there are $count possibly corrupted rows\n"; close FILE; close OUT;
the contents of processed file:
0,1,,,1,~=_<>}[]||$? £??§^`??¿ ?. Qu est çe quil Y a Yå,0,20120 +306101731 0,1,,,1,Teá,0,20120314104403 0,1,,,1,Q<8a>rUì ,0,20120306103345 1,1,,,3,,0,20120331152610 1,1,,,3,,0,20120331152612

In reply to Re^4: hex in regexp by shamanoff
in thread hex in regexp by shamanoff

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.