#!/usr/bin/perl -w use strict; use vars qw(%bar); $bar{foo} = sub { print "hello\n"}; callif($bar{foo}); callif($bar{quux}); sub callif { my $var = shift; $var->(@_) if($var); }
In reply to Re: Shortening "$bar{foo} if exists $bar{foo}"?
by sgifford
in thread Shortening "$bar{foo} if exists $bar{foo}"?
by BUU
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |