in reply to How to get substring between first and second character

A regex will "do the trick".
use strict; use warnings; my $DB_string = "Database_Test_Access_DB"; my ($get) = $DB_string =~ /_(.+?)_/; print $get, "\n";
Bill

Replies are listed 'Best First'.
Re^2: How to get substring between first and second character
by tale103108 (Novice) on Jan 17, 2013 at 19:51 UTC

    Oh wise Bill... your solution worked. One more related question. I need to trim the last few characters which could be either CISD or ISD, so that 'TestISD' becomes 'Test' and 'DevelopmentCISD' becomes 'Development'. What wisdom can you impart upon this poor soul?

      s/C?ISD$// on the captured string, or modifying BillKSmith's regex (assuming those endings are in the the original strings) to /_(.+?)C?ISD_/ would work.