in reply to extract text between two delimiters from a text line

use strict; use warnings; my $str = '../BAC-final/bac_merged1_no9.csv'; my ($substr) = $str =~ m!.*/([^_]*)_!; print "'$substr'";

Prints:

'bac'
True laziness is hard work

Replies are listed 'Best First'.
Re^2: extract text between two delimiters from a text line
by chinescu (Initiate) on Dec 02, 2011 at 02:45 UTC

    thanks for saving me, GrandFather. Your solution just as I needed.

    Many, many, thanks!