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.

Brad 'GreyBear' Davis wrote:

> I think you want:
>
> @line = (item1,item2,item3);
>
> Which would allow you to do:
>
> print $line[0];
>
> Giving you output of the value of item1, which would be value1.
>
> Using the notation of $line(item1) seems to me to serve no purpose unless
> the value of itemX isn't really valueX.
>
> The thing to remember about arrays in Perl is that they can be accessed both
> ways by merely changing the notation, hence:
>
> @line references the entire array
> $line[X] references the variable at the location in the line array specified
> by X.
>
> HTH
>
> Brad 'GreyBear' Davis - CTO, PeoplePublish, Inc.
> ----------------------------------------------------
> On the web at http://www.peoplepublish.com
> Free Market Publishing, enabled by the Internet
> ----- Original Message -----
> From: Robert Canary <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, February 21, 2000 11:12 AM
> Subject: [offtopic]Perl:assigning an array
>
> > Hi,
> >
> > Sorry for the perl question.....
> >
> > I have extracted from a log file ta line that reads that reads something
> > like this:
> > item1='value', item2='value2', item3='value3'
> >
> > i am trying to get parse the line as to assign to an array as such:
> > $line{item1}=$value1 etc etc etc
> >
> > I can't figure out how to get the line into an array.   Can anyone offer
> > some ideas?
> >
> > Thanks in advance :-)
> >
> >
> > --
> > robert canary
> > system services
> > OhioCounty.Net
> > [EMAIL PROTECTED]
> > (270)298-9331 Office
> > (270)298-7449 Fax
> >
> >
> >
> > --
> > To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
> > as the Subject.
>
> --
> To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
> as the Subject.

--
robert canary
system services
OhioCounty.Net
[EMAIL PROTECTED]
(270)298-9331 Office
(270)298-7449 Fax



-- 
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.

Reply via email to