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}
In reply to Re: print the values
by grizzley
in thread print the values
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |