bobione has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks,
Here is my mystery:
I'd like to assign a hash to a "complexe" (read big) regular expression.
Here is my mystery:
I'd like to assign a hash to a "complexe" (read big) regular expression.
m/(ID)(name)(email)(title)(date)(...)/ # simplify
I know that I can do that:
(ID, name, email, title, date, ...) = /(ID)(name)(email)(title)(date)(...)/;
but I'd like to do something like that:
%hash{ID} = (name, email, title, date, ...) = map {/(ID)(name)(email)( +title)(date)(...)/} @lignes; # Get parameters for each line... Like CSV files. But ID is not in the + same list
Something better could be to use OObject but hey, I am lost...
I hope I am clear enougth,
help will be greetfully appreciate :)
BobiOne KenoBi ;)
|
---|
Replies are listed 'Best First'. | |
---|---|
(bbfu) Re: Hash asignement with RE and map()
by bbfu (Curate) on Jul 03, 2001 at 22:45 UTC | |
by MeowChow (Vicar) on Jul 04, 2001 at 07:28 UTC | |
Re: Hash asignement with RE and map()
by dragonchild (Archbishop) on Jul 03, 2001 at 22:43 UTC | |
by bobione (Pilgrim) on Jul 03, 2001 at 23:02 UTC | |
Re: Hash asignement with RE and map()
by John M. Dlugosz (Monsignor) on Jul 03, 2001 at 22:39 UTC | |
(dkubb) Re: (2) Hash asignement with RE and map()
by dkubb (Deacon) on Jul 04, 2001 at 06:49 UTC | |
Re: Hash asignement with RE and map()
by thpfft (Chaplain) on Jul 03, 2001 at 23:05 UTC |
Back to
Seekers of Perl Wisdom