S
Steve
I have this chunk of code which is broken because I can't figure this
out. Basically I have a file handle, and the file it reads in always
starts wit ha number... 1-99. I want to ONLY get that number, and not
the rest of the line because I want to be able to copy that line that
amount of times.
while(<FH3>)
{
my $x = 0;
#Make enough records based on quantity.. broken par
if(/^[0-9]|^[0-9][0-9]/)
{
print m/^[0-9]|^[0-9][0-9]/;
}
#Check each line for a type
if(/SWITCH|MONITOR|ROUTER|KVM/)
{
print HARDWARE $_;
$x=1;
}
if(/LICENCE|LICENCES/)
{
print LICENSES $_;
$x=1;
}
if(/COMPUTER|LAPTOP|THIN/)
{
print COMPUTER $_;
$x=1;
}
if(/SOFTWARE/)
{
print SOFTWARE $_;
$x=1;
}
if(/OS|'OPERATING SYSTEM'/)
{
print OS $_;
$x=1;
}
if ($x == '0')
{
print "Warning, following line didn't match anything and was
appended to the 'other' file!\n $_\n";
print OTHER $_;
}
}
out. Basically I have a file handle, and the file it reads in always
starts wit ha number... 1-99. I want to ONLY get that number, and not
the rest of the line because I want to be able to copy that line that
amount of times.
while(<FH3>)
{
my $x = 0;
#Make enough records based on quantity.. broken par
if(/^[0-9]|^[0-9][0-9]/)
{
print m/^[0-9]|^[0-9][0-9]/;
}
#Check each line for a type
if(/SWITCH|MONITOR|ROUTER|KVM/)
{
print HARDWARE $_;
$x=1;
}
if(/LICENCE|LICENCES/)
{
print LICENSES $_;
$x=1;
}
if(/COMPUTER|LAPTOP|THIN/)
{
print COMPUTER $_;
$x=1;
}
if(/SOFTWARE/)
{
print SOFTWARE $_;
$x=1;
}
if(/OS|'OPERATING SYSTEM'/)
{
print OS $_;
$x=1;
}
if ($x == '0')
{
print "Warning, following line didn't match anything and was
appended to the 'other' file!\n $_\n";
print OTHER $_;
}
}