kepler has asked for the wisdom of the Perl Monks concerning the following question:
Greetings
So I have a string (read from a file) that has sections; so 1 line says SECTION 1 and its values follows in the next lines, until SECTION 2, and so on...I splited the string like this:
my @groups = split /(SECTION \d+)/$string;
Is there a way of automatically assing to an hash array its respective values, that is, create an hash array where
contains the respective values without a simple loop?$hasharray["SECTION 1"]
Kind regards
Kepler
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regex to array
by choroba (Cardinal) on Jan 09, 2018 at 12:46 UTC | |
by Eily (Monsignor) on Jan 09, 2018 at 13:43 UTC | |
by AnomalousMonk (Archbishop) on Jan 09, 2018 at 17:28 UTC | |
by Eily (Monsignor) on Jan 09, 2018 at 17:51 UTC | |
by AnomalousMonk (Archbishop) on Jan 09, 2018 at 18:49 UTC | |
| |
|
Re: Regex to array
by Corion (Patriarch) on Jan 09, 2018 at 12:36 UTC | |
by Eily (Monsignor) on Jan 09, 2018 at 13:40 UTC | |
by kepler (Scribe) on Jan 11, 2018 at 18:05 UTC | |
|
Re: Regex to array
by Laurent_R (Canon) on Jan 09, 2018 at 14:16 UTC |