my @images = ( [], [] ); { my( @imgstr ) = split /\|/, $str, 2; @{ $images[0] } = $imgstr[0] =~ m/(\w+\.jpg)/gi; @{ $images[1] } = $imgstr[1] =~ m/(\w+\.jpg)/gi; } #### my @images; { my @imgstr = split /\|/, $str, 2; push @images, [ $_ =~ m/(\w+\.jpg)/gi ] for @imgstr; } #### my @images = map { [ $_ =~ m/(\w+\.jpg)/gi ] } split /\|/, $str;
## my @images; { my @imgstr = split /\|/, $str, 2; push @images, [ $_ =~ m/(\w+\.jpg)/gi ] for @imgstr; } ##
## my @images = map { [ $_ =~ m/(\w+\.jpg)/gi ] } split /\|/, $str;