in reply to Extract Sub String

Hi, Try this one...
$string = "Viood_ram_shiva_RVCT22"; if ($string =~/(\w+)(_RVCT)/) { print "The file name is $1. "; }

Replies are listed 'Best First'.
Re^2: Extract Sub String
by toolic (Bishop) on Jun 21, 2011 at 12:58 UTC
    if ($string =~/(\w+)(_RVCT)/)
    There is no need for the capturing parentheses around _RVCT:
    use warnings; use strict; my $string = "Viood_ram_shiva_RVCT22"; if ($string =~ /(\w+)_RVCT/) { print "The file name is $1. "; }