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
In reply to Assigning a returned value to a hash variable by Real Perl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |