By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,245 Members | 1,287 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,245 IT Pros & Developers. It's quick & easy.

missing operator somewhere in regular expression

P: 37
Hi
I am trying to extract information from a txt file using the following code:

Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl
  2.  
  3. $i = 0;
  4. while(<STDIN>)
  5. {
  6.   m/\w+\s+(.+)\t\w+\t(\d{3})\.\d{3}\.\d{4}\t(\w+)/ employee.txt; 
  7.   print("$1\t$2\t$3\n");
  8.   ++$i
  9. }
  10. print("$i records found.");
Everytime I run the script the following error displays:

Expand|Select|Wrap|Line Numbers
  1. 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"
  2. syntax error at myscript.pl line 6, near "m/\w+\s+(.+)\t\w+\t(\d{3})\.\d{3}\.\d{4}\t(\w+)/ employee"
  3. Execution of myscript.pl aborted due to compilation errors.
  4.  
Can someone please tell me what operator is missing!

Thanks Max
Mar 7 '08 #1
Share this Question
Share on Google+
1 Reply


KevinADC
Expert 2.5K+
P: 4,059
its employee.txt
Mar 7 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.