B
Billy
Real quick question... The below script does what I want... IE open all txt
files... reads every line that starts with ~ and adds (prints) it to 001.log
file.
But my question is: Where is the information held that gets put into the log
file (on the line "print SCRIPTLOG;" it prints the line from the txt file
that was found to start with a ~.) Is this line put into a variable? If so
what is it?
In other words can I open another file later and call that same variable?
IE:
open(SCRIPTLOG2, ">>002.log") || die "Can't open myscript.log: $!";
print ?????????;
close SCRIPTLOG2;
Thank you,
Billy
#!/usr/bin/perl
use CGI::Carp qw(fatalsToBrowser);
use strict;
use warnings;
foreach my $file (<*.txt>) {
open FILE, $file or die "Can not open $file $!\n";
while (<FILE>) {
if (/~/) {
s/~([^%\^]+).*/$1/;
open(SCRIPTLOG, ">>001.log") || die "Can't open myscript.log: $!";
print SCRIPTLOG;
close SCRIPTLOG;
}
}
close FILE;
}
files... reads every line that starts with ~ and adds (prints) it to 001.log
file.
But my question is: Where is the information held that gets put into the log
file (on the line "print SCRIPTLOG;" it prints the line from the txt file
that was found to start with a ~.) Is this line put into a variable? If so
what is it?
In other words can I open another file later and call that same variable?
IE:
open(SCRIPTLOG2, ">>002.log") || die "Can't open myscript.log: $!";
print ?????????;
close SCRIPTLOG2;
Thank you,
Billy
#!/usr/bin/perl
use CGI::Carp qw(fatalsToBrowser);
use strict;
use warnings;
foreach my $file (<*.txt>) {
open FILE, $file or die "Can not open $file $!\n";
while (<FILE>) {
if (/~/) {
s/~([^%\^]+).*/$1/;
open(SCRIPTLOG, ">>001.log") || die "Can't open myscript.log: $!";
print SCRIPTLOG;
close SCRIPTLOG;
}
}
close FILE;
}