Do you know where your variables are? | |
PerlMonks |
Functions (Return V Print)by packetstormer (Monk) |
on Feb 04, 2011 at 09:46 UTC ( [id://886163]=perlquestion: print w/replies, xml ) | Need Help?? |
packetstormer has asked for the wisdom of the Perl Monks concerning the following question:
I'm back again, struggling with some basics (I have read up on this but I just can't figure it). I will post code below but in a nutshell I pass a string to a function and do stuff, then return a variable. The problem is if, at the end of the function I use:
I can see the result in the perl script I called the function from. However, if I use:
I can't use that $title back in the script I called it from. There is no error (I am using strict) it just seems the string is empty. The code I use is below:
If I change that return to print, the function prints the correct result back in the script. If I use return, then try and print $title from the script, I get nothing!
Back to
Seekers of Perl Wisdom
|
|