Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
How to print the values only when $names only when $names doesnot exists in @names_hash#!/usr/bin/perl use strict; use warnings; my $names; my @name; while(<DATA>){ if(/{(.*)}/){ my @names_hash = qw{NAME AGE}; $names = $1; push (@name, $names); next if $names !(exists(@names_hash)); print $names; } } print @name; __DATA__ {NAME} {AGE} {SEX} {ADDRESS} {ADDRESS}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: print the values
by grizzley (Chaplain) on Nov 05, 2009 at 08:52 UTC | |
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 | |
|
Re: print the values
by Marshall (Canon) on Nov 05, 2009 at 17:34 UTC |