Real Perl has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks,
I need your wisdom to understand why I am getting a SCALLAR(....) instead of the value I expect. Here is where I assign the returned value after I call the sub:This is the fix_path sub:sub confirm(){ if($gGui{single}==1){ print "source variable BEFORE fix_path $gGui{original_source}\n"; $gGui{original_source} = \&fix_path("$gGui{original_so +urce}"); print "source variable AFTER fix_path $gGui{original_source}\n"; . . .
With print statements, I was able to determine that the value sent to and returned by the fix_path are correct, but the second print statement give me SCALAR(0x3618594).sub fix_path{ my ($path) = @_; my @patharray= split '/', $path; my @newpatharray; $path = ""; foreach (@patharray){ $_ =~s/ /_/g; $_ .= "\\"; push @newpatharray, $_; }#foreach foreach (@newpatharray){ $path .= $_; }#foreach return $path; }#fix_path
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Assigning a returned value to a hash variable
by pg (Canon) on Sep 04, 2005 at 04:45 UTC | |
|
Re: Assigning a returned value to a hash variable
by GrandFather (Saint) on Sep 04, 2005 at 06:37 UTC | |
|
Re: Assigning a returned value to a hash variable
by jonadab (Parson) on Sep 04, 2005 at 09:58 UTC |