Jeff 'japhy' Pinyan wrote:
On May 18, Dale said:
I thought that I could remove lines from the data by matching whether
the first character was a letter by using the 'if' statement as :
if(substr($line,0,1) eq [a-zA-Z])
...but this doesn't work. Neither does :
if($line eq [\s\d])
...to try and find if it's just contain numbers and spaces.
They don't work because eq is for strings, and you're trying to use
character classes (or more generally, regexes).
if (substr($line, 0, 1) =~ /[a-zA-Z]/) { ... }
And if you want to match letters that are not ASCII characters:
if (substr($line, 0, 1) =~ /[[:alpha:]]/) { ... }
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>