Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > How to test for existance ?

Thread Tools

How to test for existance ?

no spam
Posts: n/a
Here's a small script to show what I am trying to do:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~
#!/usr/bin/perl -w

sub print_yep
print "yep...\n";

$function1 = "print_yep";
$function2 = "rubbish";

$vector->{ACTION1} = \&$function1;
$vector->{ACTION2} = \&$function2;

print "something's fishy !\n" if (! exists $vector->{ACTION2});


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~

How can I test if a function exist or not ?
Shouldn't this print "something's fishy" ??
I've tried to use defined, to deference in different ways, but I can't get
it working.


Yves Dorfsman

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Co-existance with VS 6? james ASP .Net 1 04-22-2005 06:20 PM
How to test for existance ? no spam Perl Misc 2 02-21-2005 01:56 PM
check Existance of a file on different machine Ajit ASP .Net 5 09-26-2003 10:59 AM
Test an Array for existance before processing data Jacob ASP General 2 07-07-2003 05:28 PM
test test test test test test test Computer Support 2 07-02-2003 06:02 PM