in reply to how to read words in a line into separate variables
You can use a regular expression with capture groups in list context:
my $string = q{write("thepath",8'h44,status,"info")}; my ($e, $a, $b, $c, $d) = $string =~ /\A(.+?)\("(.+?)",(.+?),(.+?),"(. ++?)"\)\Z/;
I don't know the exact format of your data, so I used non-greedy anything match (.+?). It's better to adjust the expression to the format as strictly as possible, though.
|
|---|