If this is for perl code, as your tags imply, then you would typically use grep:
my @all = qw(
    12345_lrg.jpg
    12445_sml.jpg
    14445_sml.jpg
    12345_lrg.jpg
    42345_lrg.jpg
);
my @sml = grep /_sml\.jpg$/i, @all;
2
solved Grep certain files only