allison has asked for the wisdom of the Perl Monks concerning the following question:
my code foe the extract numeric id isDD: 11/09/2009 AU: jas dimaano PP: Employee ID list PP: (489459) Jas = DS16 -> with SPi since 2005/04/04 AND with ECO ever + since PP: Sam = FT35 -> resigned last 09-03-2008 PP: Evan = AT89 -> transferred last 20070605 to Journals PP: there's more... === DD: july 11, 2009 AU: Jr s. Tolentino, -editor PG: page 9 PP: Earn points now! PP: Yes! You heard it right! (635436)
the output went to DD: 11/09/2009 AU: jas dimaano PP: Employee ID list PP: Jas = DS16 -> with SPi since 2005/04/04 AND with ECO ever since PP: Sam = FT35 -> resigned last 09-03-2008 PP: Evan = AT89 -> transferred last 20070605 to Journals PP: there's more... === DD: july 11, 2009 AU: Jr s. Tolentino, -editor PG: page 9 PP: Earn points now! PP: Yes! You heard it right! <code>#!usr/local/bin/perl $filename = "input.txt"; open (FILE,"<$filename"); @fileinput=<FILE>; close(FILE); foreach $line(@fileinput) { my $test=($line); #add written by and capital the first letter of each word if($test=~s/AU: \b(\w+)|AU: \b(w+)\s\b(w+)/AU: Written by: \u$1 \u$2 +/g) { print $test; } }
Where's the numeric id go? how can I place it with the tag 'ID: ' above the AU: tag?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Where is now the extract numeric id in the parenthesis
by Nikhil Jain (Monk) on Mar 21, 2011 at 07:59 UTC | |
|
Re: Where is now the extract numeric id in the parenthesis
by JavaFan (Canon) on Mar 21, 2011 at 12:02 UTC |