in reply to Extract a small part of a long sentence using regular expressions

Your regex doesn't work because you are looking for a number at the beginning of the line, but your line starts with a "[" character. You could grab all the contents between the parens, then split on comma:
use warnings; use strict; use Data::Dumper; my @actionData; while (my $line = <DATA>) { if ( $line =~ /action\(([^)]+)\)/ ) { my @nums = grep { $_ != 0 } split /,/, $1; push @actionData, @nums; } } print Dumper(\@actionData); __DATA__ [AHB_REPORTER][INFO]: action(62,1,0,0,0,0,5,53,9,0,190)D:/XYZ/reg/Test +s/Mcu/A_test.cCALL: (null)

outputs:

$VAR1 = [ 62, 1, 5, 53, 9, 190 ];

Replies are listed 'Best First'.
Re^2: Extract a small part of a long sentence using regular expressions
by swatzz (Novice) on Dec 02, 2014 at 13:34 UTC
    Oh more importantly, thanks for the help on regular expression. I hope someday i can figure this thing out right!
Re^2: Extract a small part of a long sentence using regular expressions
by swatzz (Novice) on Dec 02, 2014 at 13:32 UTC
    Thank you toolic! Using grep never occured to me!!

    Cheers!