in reply to String Matching

There are a number of ways of going about providing a solution to your problem. I have gone for a simple regex;
#!/usr/bin/env perl use strict; use warnings; use Data::Dumper; my @lines = ( "[HAVE 1324,2,32,324,5,643]", "[HAVE 4,213,5432,4]"); for my $line (@lines) { my @numbers; while ($line =~ /(\d+)/g) { push @numbers, $1; } print Dumper \@numbers; }
Produces the following output;
$VAR1 = [ '1324', '2', '32', '324', '5', '643' ]; $VAR1 = [ '4', '213', '5432', '4' ];

You could use s/// to remove the extra characters and use split on the commas if you like.