[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-users] Webalizer problem



On Sat, 3 Nov 2001, MikeM wrote:
> It is a string.  The script is written in Perl.  
The excerpt that I posted in the message works fine,

Oh how i hate when people tell me i'm wrong ;)
OK, Perl 101...here's a test program....try it, you'll like it....

#!/usr/local/bin/perl

system "touch ./junkfile";

$x="file";
print "creating file\n";
if (!-e './junk$x') {print "file doesn't exist\n";}
if (-e './junk$x')  {print "file exists\n";}
unlink "./junkfile";
print "deleted file\n";
if (!-e './junk$x') {print "file doesn't exist\n";}
if (-e './junk$x')  {print "file exists\n";}
print "===\n";
print "creating file\n";
system "touch ./junkfile";
if (!-e "./junk$x") {print "file doesn't exist\n";}
if (-e "./junk$x")  {print "file exists\n";}
print "deleting file\n";
unlink "./junkfile";
if (!-e "./junk$x") {print "file doesn't exist\n";}
if (-e "./junk$x")  {print "file exists\n";}
exit;

If your theory is correct, it should work both ways...
But it doesn't...

disktool# ./p.pl
creating file
file doesn't exist
deleted file
file doesn't exist
===
creating file
file exists
deleting file
file doesn't exist

Notice it says the file doesn't exist BOTH ways with ''s

(as expected, since perl doesn't expand the variable properly)

$x="hello";
print '$x there\n';
exit

./testme.pl
$x there\n

gsh