Got to something worng with this code.  Are you sure it's perl?  I mean,
I can understand it.  too easy.  I wrote a perl script to parse a bunch
of stuff from debug logs in a long running program about a year ago
(thanks to O'riley and this list) and when I went back a couple of weeks
ago I had no @&* idea what I had done.  Really powerful really cryptic. 
Like I said earlier are you sure this is perl?

:) 

Bret
rpjday wrote:
> 
> On Mon, 21 Feb 2000, David Kramer wrote:
> 
> > Robert Canary wrote:
> > >
> > > Hello GreyBear,
> > >
> > > The problem is the the items(item1,item2,item3) are coming from a log file of
> > > another app.  So I must first must split them from the line that I am cutting
> > > out of the logfile.  The log file line states them as item1='value1',
> > > tem2='value2' all on one line there is seven item=value pairs on one line of
> > > extracted text.  I can capture the text of the log file.  But I can't get it
> > > into an array.   I was trying the item/value scenario as though you would read
> > > it from a file.  But the only way I can get a loop to roll over is if it is an
> > > array.
> >
> > OH.  I didn't know there would be multiple a=b on the same line.  try
> > this:
> > --------------------------
> > open(IN,"foo") or die("$0: Could not open foo for read: $1");
> >
> > #Read file, load array
> > while(<IN>)
> > {
> >       chomp();
> >       $Line=$_;
> >       while($Line =~ s/^(\w+)=(\w+)\,{0,1}\s*//)
> >       {
> >               if($1 ne '')
> >               {
> >                       $Line{$1}=$2;
> >               }
> >       }
> > }
> >
> > foreach $Key (keys(%Line))
> > {
> >       print("[$Key]=[$Line{$Key}]\n");
> > }
> 
> ================
> 
> open(IN, logfile) ;
> 
> while(<IN>) {
>         foreach (split) {
>                 ($key, $value) = split("=") ;
>                 print "$key, $value\n" ;
>         }
> }
> close IN ;
> 
> ================
> 
>   once you get the values in $key and $value, do with them whatever
> you wish.
> 
> rday
> 
> --
> To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
> as the Subject.
begin:vcard 
n:Hughes;Bret 
tel;fax:918.587.0131
tel;work:918.587.0131
x-mozilla-html:FALSE
url:www.elevating.com
org:Elevating Communications Inc
adr:;;PO Box 1323;Tulsa;OK;74101-1323;USA
version:2.1
email;internet:[EMAIL PROTECTED]
title:Chief Solutionist/President
x-mozilla-cpt:;19888
fn:Bret  Hughes
end:vcard

Reply via email to