NEVERSLEEP
Programmer
i wanted to show someone....
now im the one needing help![[lol] [lol] [lol]](/data/assets/smilies/lol.gif)
on perl -c "find.pl syntax OK"
on run infinite time those two error
Use of uninitialized value in numeric eq (==) at C:\Documents and Settings\Administrator\Desktop\fin
d.pl line 30, <stdin> line 2.
Use of uninitialized value in numeric eq (==) at C:\Documents and Settings\Administrator\Desktop\fin
d.pl line 70, <stdin> line 2.
the code
thanks for your help
first time im playing with @ARGV
---------------------------------------
someone knowledge ends where
someone else knowledge starts
now im the one needing help
![[lol] [lol] [lol]](/data/assets/smilies/lol.gif)
on perl -c "find.pl syntax OK"
on run infinite time those two error
Use of uninitialized value in numeric eq (==) at C:\Documents and Settings\Administrator\Desktop\fin
d.pl line 30, <stdin> line 2.
Use of uninitialized value in numeric eq (==) at C:\Documents and Settings\Administrator\Desktop\fin
d.pl line 70, <stdin> line 2.
the code
thanks for your help
first time im playing with @ARGV
Code:
use strict;
my $count = 0; # line counter
my $so; # <stdin> so ?
my $switch = 0; # default dir switch
my $dwitch = 0; # deeplook switch
my @drives = ('c','d','e','f'); # place as many as u like
my $manualdrive; # manual drive
my $manualfile; # manual file
my @dir_output; # dir storer
&startup; # here we goooooooo!
sub startup {
&bad_argument(1) unless $ARGV[0]; # check if drive letter was unspecified
&bad_argument(2) unless $ARGV[1]; # check if file name was unspecified
&bad_argument(3) if $ARGV[2]; # check if surspecified
$ARGV[0] =~ tr/a-zA-Z/ /cs;
$ARGV[0] =~ s/\s//g;
$ARGV[1] =~ tr/a-zA-Z0-9[.][_]/ /cs;
$ARGV[1] =~ s/\s//g;
@dir_output = `dir $ARGV[0]:\\$ARGV[1].pl /s/o/b`;
&find_it;
}
sub find_it {
if ($dir_output[0] == "File Not Found") { # check if not found of this drive
&deeplook;
} elsif ($dir_output[1]) { # check if there is more than one result possible
&multiple;
} else { # haddle single result
&single($dir_output[0]);
}
}
sub bad_argument {
if ($_[0] == 1) { # no drive specified
print "\nmanual";
&manual
} elsif ($_[0] == 2) { # no filename
print "\nmanual";
&manual;
} elsif ($_[0] == 3) { # warn
print "\nToo Many parameters";
}
}
sub manual {
print "\nDrive letter :";
$manualdrive = <stdin>;
chomp $manualdrive;
$manualdrive =~ tr/a-zA-z/ /cs;
$manualdrive =~ s/\s//g;
print "\nFile name (no extention) :";
$manualfile = <stdin>;
chomp $manualfile;
$manualfile =~ tr/a-zA-z/ /cs;
$manualfile =~ s/\s//g;
@dir_output = `dir $manualdrive:\\$manualfile.pl /s/o/b`;
&find_it;
}
sub deeplook {
while ($dwitch != scalar(@drives)) { # loop for the lenght of @drives
@dir_output = `dir $drives[$dwitch]:\\$ARGV[1].pl /s/o/b`;
$dwitch++;
} next if ($dir_output[0] == "File Not Found")
&find_it;
}
sub multiple { # deeplook sub
print "Multiple Results Please chose file by number at left\n";
foreach (@dir_output) {
print "\n<$count> - $_";
}
print "\nEnter your file number :";
$so = <stdin>;
chomp $so;
$so =~ tr/0-9/ /cs; # all non 0-9 chages to spaces
$so =~ s/\s//g; # supress spaces
if (($so == 0) || ($so > $count)) { # check if valid file number
&multiple;
} else { # u have chosen goto single
&single($dir_output[$so]);
}
}
sub single {
system("notepad.exe $_[0]");
&end_of_script;
}
sub end_of_script {
print "\nHit Enter to quit";
while (! <stdin>) {sleep;}
exit;
}
---------------------------------------

someone knowledge ends where
someone else knowledge starts