Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^3: store rest of the lines in a array after a matching pattern is found

by AnomalousMonk (Archbishop)
on May 17, 2018 at 19:07 UTC ( [id://1214780]=note: print w/replies, xml ) Need Help??


in reply to Re^2: store rest of the lines in a array after a matching pattern is found
in thread store rest of the lines in a array after a matching pattern is found

Tried that option ...

You don't say what option you tried (a mortal sin in the Monastery), but one can make a guess at your code:

c:\@Work\Perl\monks>perl -wMstrict -le "my $str = 'ServiceCategoryName=(3,1,0,1,1,0)'; ;; if ($str =~ m/^ServiceCategoryName=(.*/) { print qq{'$str'}; my @array = split /,/, $str; print qq{first split element: '$array[0]'}; } " Unmatched ( in regex; marked by <-- HERE in m/^ServiceCategoryName=( < +-- HERE .*/ at -e line 1.
roboticus has suggested ways to fix this:
c:\@Work\Perl\monks>perl -wMstrict -le "my $str= 'ServiceCategoryName=(3,1,0,1,1,0)'; ;; if ($str =~ m/^ServiceCategoryName=\((.*)\)/) { print qq{parenthesized substring: '$1'}; my @array = split /,/, $1; print qq{first split element: '$array[0]'}; } " parenthesized substring: '3,1,0,1,1,0' first split element: '3'
In future, please show exactly what you have tried, the exact output you got, and what you wanted. Please see Short, Self-Contained, Correct Example.


Give a man a fish:  <%-{-{-{-<

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1214780]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (None)
    As of 2024-04-18 23:40 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found