missing operator somewhere in regular expression

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Max58kl
    New Member
    • Nov 2007
    • 37

    missing operator somewhere in regular expression

    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:

    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.
    Can someone please tell me what operator is missing!

    Thanks Max
    Last edited by eWish; Mar 8 '08, 12:02 AM. Reason: Please use code tags
  • KevinADC
    Recognized Expert Specialist
    • Jan 2007
    • 4092

    #2
    its employee.txt

    Comment

    Working...