R
Robert TV
Hi, I thought I read somewhere once that creating a scalar value from other
scalars is bad. My small script below creates a data based on the users IP
address and the current Epoch. I'm asking for advice on whether this is bad
scripting.
__ACTUAL CODE__
#!/usr/bin/perl
use CGI qw/:standard/;
use CGI::Carp qw(fatalsToBrowser);
$timestamp = time();
$ipaddress = $ENV{'REMOTE_ADDR'};
$ipaddress =~ s/\.//g; #remove periods from IP address
$filename = "$ipaddress\_$timestamp\.dat";
open (FILE,">>$filename"); #create new filename based on above variables
close(FILE);
print header;
print "File name: $filename has been created on server";
exit;
__END CODE__
The above creates a new file on the server with a name similair to
"20553102224_1087758244.dat". While the code functions without error, is the
scripting sound? I would appreciate alternative methods if this script is
inefficient or erroneous. Thank you.
Robert
scalars is bad. My small script below creates a data based on the users IP
address and the current Epoch. I'm asking for advice on whether this is bad
scripting.
__ACTUAL CODE__
#!/usr/bin/perl
use CGI qw/:standard/;
use CGI::Carp qw(fatalsToBrowser);
$timestamp = time();
$ipaddress = $ENV{'REMOTE_ADDR'};
$ipaddress =~ s/\.//g; #remove periods from IP address
$filename = "$ipaddress\_$timestamp\.dat";
open (FILE,">>$filename"); #create new filename based on above variables
close(FILE);
print header;
print "File name: $filename has been created on server";
exit;
__END CODE__
The above creates a new file on the server with a name similair to
"20553102224_1087758244.dat". While the code functions without error, is the
scripting sound? I would appreciate alternative methods if this script is
inefficient or erroneous. Thank you.
Robert