P0w3rK!d has asked for the wisdom of the Perl Monks concerning the following question:
Given the error:
from this code:Can't use string ("123.xml") as a SCALAR ref while "strict refs" in use at C:\Work\foo.PL line 357.
$strFileB prints out as 123.xml:# Note: strFileA = C:\foo\a\b\c\123.xml my @aryFile = split (/\//, $strFileA); my $intSize = @aryFile; $strFileB= \$aryFile[$intSize-1];
but when I call this:05/12 13:55:10 [DBUG] performing FTP of C:/Work/ftp/123.xml...
The file on the ftp site says: (0x1df8cb0) ..see below:$ftp->put($strFileA, $strFileB) or die "FTP: Couldn't put $strFileB.";
I tried the hard reference with(000025) 5/12/2003 2:04:21 PM - perlmonk (123.45.67.186) > STOR SCALAR +(0x1df8cb0) (000025) 5/12/2003 2:04:21 PM - perlmonk (123.45.67.186) > asked to up +load 'SCALAR(0x1df8cb0)' in 'C:\Temp\' --> Access allowed. (000025) 5/12/2003 2:04:21 PM - perlmonk (123.45.67.186) > 150 Opening + data connection for SCALAR(0x1df8cb0). (000025) 5/12/2003 2:04:21 PM - perlmonk (123.45.67.186) > started upl +oading 'SCALAR(0x1df8cb0)' in 'C:\Temp\'. (000025) 5/12/2003 2:04:21 PM - perlmonk (123.45.67.186) > 226 File re +ceived ok. (000025) 5/12/2003 2:04:21 PM - perlmonk (123.45.67.186) > finished up +loading 'SCALAR(0x1df8cb0)' in 'C:\Temp\' - (00:00:01 - 8.345 KB - 8 +.345 KBytes/s).
but that did not do it.\$aryFile[$intSize-1];
1. Is there a better way to trim down to the filename?
2. What did I do wrong to get $strFileB?
Thanks. :)
-P0w3rK!d
P.S.: I already checked the archives before posting this question. I did not find an answer.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Referencing string: Can't use string as a SCALAR ref
by Limbic~Region (Chancellor) on May 12, 2003 at 18:14 UTC | |
by P0w3rK!d (Pilgrim) on May 12, 2003 at 18:33 UTC | |
by antirice (Priest) on May 12, 2003 at 19:23 UTC | |
by P0w3rK!d (Pilgrim) on May 12, 2003 at 18:17 UTC | |
Re: Referencing string: Can't use string as a SCALAR ref
by P0w3rK!d (Pilgrim) on May 12, 2003 at 18:20 UTC | |
by cbro (Pilgrim) on May 12, 2003 at 18:41 UTC |