Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

return command out of subroutine 1

Status
Not open for further replies.

vietboy505

Technical User
Feb 20, 2006
56
US
How can I use Perl to return to another script that I call?
Any help?

Here is my nameconfig.pl file.

PHP:
#!/usr/local/bin/perl

$names="a";

%name =(
"a" => "andy",
"b" => "ben",
"c" => "cat"
);

return "$name{$names}";

and here is my other script to call this nameconfig.pl

PHP:
#!/usr/local/bin/perl

$what=`nameconfig.pl` . " was here!";

print("NAME: " . $what . "\n\n");

$another=`nameconfig.pl`;

print("NAME: " . $another . "was here and it did work!\n\n");

OUTPUT
Code:
Can't return outside a subroutine at C:\SCRIPT\nameconfig.pl line 11.
NAME:  was here!

Can't return outside a subroutine at C:\SCRIPT\nameconfig.pl line 11.
NAME: was here and it did work!
 
require "nameconfig.pl";

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top