in reply to Spreadsheet::WriteExcel::Big is Bigger

I find that the portion of your code like
my $ip1 = $1; my $port1 = $2;
is suspect. As soon as this scope ends, these two variables (and their values, of course) disappear, yet you are using them in the push statement. I see you are using use strict; -- doesn't Perl complain about these undefined values?

I would declare those two variables up higher, near the split statement -- then they stay in scope long enough to be used by the push statement.

Sure hope I'm not missing anything obvious here. :(

--t. alex

"Of course, you realize that this means war." -- Bugs Bunny.

Replies are listed 'Best First'.
(shockme) Re: Re: Spreadsheet::WriteExcel::Big is Bigger
by shockme (Chaplain) on Jan 23, 2002 at 22:25 UTC
    Nope, you're not missing a thing. I uploaded the wrong version of my script. Here's the portion you're questioning from the actual script:
    while ($inLine = <IN>) { my ($ip1, $port1, $ip2, $port2) = 0; my ($date, $log, $protocol, $firstIP, $secondIP, $packets) = split(/,/, $inLine); # strip port number if it exists if ($firstIP =~ /([\d.]+)\((\d+)\)/) { $ip1 = $1; $port1 = $2; } else { $ip1 = $firstIP; $port1 = " "; } if ($secondIP =~ /([\d.]+)\((\d+)\)/) { $ip2 = $1; $port2 = $2; } else { $ip2 = $secondIP; $port2 = " "; }

    After a quick review, that seems to be the only difference. Sorry for the confusion.

    If things get any worse, I'll have to ask you to stop helping me.