in reply to Regex to array
#! /usr/bin/perl use warnings; use strict; my $text = << '__TEXT__'; SECTION 1 This is the first section. SECTION 2 And this is the second one. __TEXT__ my %section = ("", split /(SECTION \d+)/, $text); delete $section{""}; use Data::Dumper; print Dumper \%section;
Update: Note that hashes use curly brackets, not the square ones (unlike in PHP).
($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regex to array
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 | |
by Eily (Monsignor) on Jan 10, 2018 at 09:20 UTC |