in reply to split and matching

Any other better ways to solve this for both sno and toss parts together?

Seeing how that doesn't do what you're hoping it does, there surely must be

Start with

use strict; use warnings; my @fields = ( 0 .. 7, "something" ); if ( $fields[8] =~ /^[sno]/ =~ /^[sno]/ ) { print "uh oh\n"; } else { print "oh no\n"; } __END__ oh no

Then run as perl -Mre=debug uhohohno.pl and see what happens

Then rewrite it to do what you want, see perlintro/perlrequick