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.