Re: print statement creates key in hash with reference to empty array??
- From: "Dr.Ruud" <rvtol+news@xxxxxxxxxxxx>
- Date: Tue, 31 Jan 2006 18:07:11 +0100
A. Sinan Unur schreef:
> if( exists $hash{$key} ) {
> print "$hash{$key}\n";
> }
Hunting for alternatives:
$ echo 'if( exists $hash{$key} ) { print "$hash($key)\n"; }' \
| perl -MO=Deparse,-x7
exists $hash{$key} and do {
print "$hash($key)\n"
};
I don't know why the do-block is needed.
$ echo 'print "$hash{$key}\n" if exists $hash{$key};' \
| perl -MO=Deparse,-x7
exists $hash{$key} and print "$hash{$key}\n";
--
Affijn, Ruud
"Gewoon is een tijger."
.
- Follow-Ups:
- References:
- print statement creates key in hash with reference to empty array??
- From: rhorizon74
- Re: print statement creates key in hash with reference to empty array??
- From: A. Sinan Unur
- print statement creates key in hash with reference to empty array??
- Prev by Date: FAQ 1.15 Where can I get a list of Larry Wall witticisms?
- Next by Date: Re: print statement creates key in hash with reference to empty array??
- Previous by thread: Re: print statement creates key in hash with reference to empty array??
- Next by thread: Re: print statement creates key in hash with reference to empty array??
- Index(es):
Relevant Pages
|