ericdp has asked for the wisdom of the Perl Monks concerning the following question:
But something is getting through. I'd like to find out what. I think it might be a tab character, but I am not sure. So I thought I'd parse through my file and see if I can find it. .... ok, this is where I need help. :) Am I on the right track?SELECT ... SUBSTR ( REPLACE ( REPLACE ( memo_system_txt, CHR(10), '' ), CHR(13), +'' ), 1, 255 ) AS memo_sys_txt, ...
Getting:#!/usr/bin/perl use strict; use warnings; open F, "memo.txt"; open X, ">memo.txt_error"; my $row; my $line; $row = 0; while (<F>) { chomp; $line = $_; $row++; # Look for any lines of the wrong length # if ( length $line != 2340 ) # { # printf X "%u : ||%s||\n", $row, $line; # } # Find any control characters if ( $line =~ /[[:cntrl]]/ ) { my $c = $1; printf X "%u : ||%s||\n", $row, $line; printf X "\t : ||%s||\n", ORD($c); print X "---------------------------"; } } close X; close F;
printf() on unopened filehandle X at ./a2.pl line 20, <F> line 150. Can't call method "ORD" without a package or object reference at ./a2.pl line 21, <F> line 150What did I get wrong? I'd like to find the numeric value (i.e. ORD(tab) is 9) and where in the line the character is located. Thanks for your help. Eric
Edit: g0n - replaced pre tags with code tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Searching for control characters
by holli (Abbot) on Feb 07, 2006 at 20:33 UTC | |
|
Re: Searching for control characters
by Fletch (Bishop) on Feb 07, 2006 at 20:34 UTC | |
by ericdp (Novice) on Feb 07, 2006 at 20:48 UTC | |
by Fletch (Bishop) on Feb 07, 2006 at 20:54 UTC | |
by ericdp (Novice) on Feb 07, 2006 at 20:55 UTC | |
|
Re: Searching for control characters
by graff (Chancellor) on Feb 07, 2006 at 23:29 UTC | |
by ericdp (Novice) on Feb 08, 2006 at 16:45 UTC | |
by ericdp (Novice) on Feb 08, 2006 at 17:31 UTC | |
|
Re: Searching for control characters
by GrandFather (Saint) on Feb 07, 2006 at 20:35 UTC | |
by ericdp (Novice) on Feb 07, 2006 at 22:10 UTC |