Re: Need help with a question.
- From: Anonymous coward <anonymous@xxxxxxx>
- Date: Sat, 28 Jun 2008 23:00:33 +0200
On Sat, 28 Jun 2008 13:18:08 -0700, Trev wrote:
On Jun 28, 1:40 pm, Ben Morrow <b...@xxxxxxxxxxxx> wrote: Thanks Ben for
the detailed reply, I've been able to get the output correct, but I'm
stuck on how to read $cpqlogline into an array without writing it to a
file.
push @array, $cpqlogline;
open (OTF, ">blah.txt");
print OTF $DAT;
That makes no sense at all. Why would you want to print a filehandle
$cpqlogline =~ s/ <FIELD NAME="Subject" VALUE="//i;
$cpqlogline =~ s/ <FIELD NAME="MAC" VALUE="//i;
$cpqlogline =~ s/"\/>//i;
Can't you do that in a more robust manner? XML::Simple is your friend. Or
a single m// regexp if you are certain the order of the attributes is
always the same.
open (TMP, ">>$mactmp");
print TMP "$server". "," . "$cpqlogline\n"; close TMP;
Why do you open and close a file inside a loop? Why don't you just say
print "$server,$cpglogline\n" ?
}
close OTF;
You might want to close that in the same block as where you opened it.
print LOG "$lines[1]";
What do the quotes serve for?
unlink "blah.txt";
Why unlink that here?
When the script runs it only creats the logfile with one line:
server1,00-00-00-00-00-01
When it should show:
server1,00-00-00-00-00-01
server2,00-00-00-00-00-01
server3,00-00-00-00-00-01
I see the problem is that the CreateLog only reads value[1] since the
above sub writes everything into mactmp.txt then only CreateLog is run.
Any ideas?
This program makes absolutely no sense to me. What are you trying to do
exactly? Can you give a bit more description?
Cheers,
Leon
.
- Follow-Ups:
- Re: Need help with a question.
- From: Jürgen Exner
- Re: Need help with a question.
- References:
- Need help with a question.
- From: Trev
- Re: Need help with a question.
- From: Ben Morrow
- Re: Need help with a question.
- From: Trev
- Need help with a question.
- Prev by Date: Re: Need help with a question.
- Next by Date: Re: Need help with a question.
- Previous by thread: Re: Need help with a question.
- Next by thread: Re: Need help with a question.
- Index(es):
Relevant Pages
|