Hi
I am trying to extract information from a txt file using the following code:
[CODE=perl]#!/usr/bin/perl
$i = 0;
while(<STDIN>)
{
m/\w+\s+(.+)\t\w+ \t(\d{3})\.\d{3 }\.\d{4}\t(\w+)/ employee.txt;
print("$1\t$2\t $3\n");
++$i
}
print("$i records found.");[/CODE]
Everytime I run the script the following error displays:
Can someone please tell me what operator is missing!
Thanks Max
I am trying to extract information from a txt file using the following code:
[CODE=perl]#!/usr/bin/perl
$i = 0;
while(<STDIN>)
{
m/\w+\s+(.+)\t\w+ \t(\d{3})\.\d{3 }\.\d{4}\t(\w+)/ employee.txt;
print("$1\t$2\t $3\n");
++$i
}
print("$i records found.");[/CODE]
Everytime I run the script the following error displays:
Code:
Bareword found where operator expected at myscript.pl line 6, near "m/\w+\s+(.+)\t\w+\t(\d{3})\.\d{3}\.\d{4}\t(\w+)/ employee"
syntax error at myscript.pl line 6, near "m/\w+\s+(.+)\t\w+\t(\d{3})\.\d{3}\.\d{4}\t(\w+)/ employee"
Execution of myscript.pl aborted due to compilation errors.
Thanks Max
Comment