in reply to print the values
Why an array has the name names_hash? You are correct you want hash there, so define hash, not array:
#!/usr/bin/perl use strict; use warnings; my $names; my @name; while(<DATA>) { if(/{(.*)}/) { $names = $1; my %names_hash = qw{NAME 1 AGE 1}; push @name, $names; next if ! exists $names_hash{$names}; print $names; } } print @name; __DATA__ {NAME} {AGE} {SEX} {ADDRESS} {ADDRESS}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: print the values
by Anonymous Monk on Nov 05, 2009 at 09:02 UTC | |
by chromatic (Archbishop) on Nov 05, 2009 at 09:49 UTC | |
by grizzley (Chaplain) on Nov 05, 2009 at 12:12 UTC |