in reply to Re^2: Sed in perl
in thread Sed in perl

I would
my $cmd = "tac temp.xx | sed -n '/$mod /,/YYY/ p'| grep XXX"; print "executing: '$cmd'\n"; $hier = `$cmd`; print "result: '$hier'\n";
to actually see what's going on.