![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Its PERL + Comma separated seventh field | ganapati | Shell Programming and Scripting | 17 | 06-24-2009 05:20 AM |
| field separator in Perl | ahsog | Shell Programming and Scripting | 38 | 04-17-2009 09:30 PM |
| Perl sort unique by one field only | Donkey25 | Shell Programming and Scripting | 2 | 03-20-2009 10:15 AM |
| perl regular expressions and field search | dynamox | Shell Programming and Scripting | 4 | 09-02-2008 10:46 AM |
| [awk]: Row begins by random number and field 10 is greater than 10.00% | Lomic | Shell Programming and Scripting | 3 | 03-18-2005 09:59 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Perl if field begins with.......
Hi, This must be simple but I can't get it to work. I have the follow code to insert the contents of a file into an array and then I want to print the value of a container where all of the records in another container within the array start with 33 (that's not all I want to do but it is all I want to do right now). Code:
$file_name="/home/file1";
open(DATA, $file_name) || die ("Could not open file!");
@deliver_data=<DATA>;
close(DATA);
foreach $line (@deliver_data)
{
chop($line);
($id,$day,$ref,$originator,$destination,$type,$code)=split(/,/,$line);
}
if $destination /^33/;
{
print "$code";
}
I keep getting this error: Code:
syntax error at ./andrews_perl_foreign_calc.pl line 27, near "if $destination " Execution of ./andrews_perl_foreign_calc.pl aborted due to compilation errors. Many thanks! |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|