use strict; use Data::Dumper; use Carp; my $str = $ARGV[0] || '|78187980|ref|NM_0'; if ( $str =~ / /xms ) { print "no underscore\n"; } else { print "with underscore\n"; } #### $str = "TIP UPSTREAM";