gregg wrote:
>
> > I have a debug log subroutine that I copy and paste into different
> > Perl modules as I am working on them. It occurred to me that it would
> > be very useful to log the line numbers to the file as a better means
> > of keeping track of what a script is doing, and finding the location
> > using the vi editor. This might be a stupid question or simply one
> > for some genius out there to answer:
>
> I would like something like
>
> #!/usr/bin/perl -w
>
> ---- code ----
>
> &DebugLog("I am at line: $line_number_in_the_script");
>
> --- more code -----
>
> Sub DebugLog()
> {
> my ($line) = @_;
> print "$line\n";
>
> }
>
use strict;
DebugLog('I am at line: '. __LINE__ );
DebugLog('I am at line: '. __LINE__ );
DebugLog('I am at line: '. __LINE__ );
print 'I am at line: '. __LINE__ ."\n";
sub DebugLog
{
my $line = shift;
print "$line\n";
}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]