I need to remove $b from $a
$a =~ s/\Q$b//;
(Or you can use a non-Perlish solution using substr() and index()
that'll take longer to write, be difficult to read, look less like
Perl but will probably run a little faster).
$a = "abc/\def/ghi" ;
$b = "abc/\def";
BTW you should always develop with warnings on. The above generates
two "Unrecognized escape \d passed through" warnings.
This looks like a homework question. The s/// operator is usually
covered quite early in any Perl course.
If this is a taught course be aware there's a fair chance your teacher
will be monitoring Usenet so you are not going to fool anyone.
If you are leaning from a book, doesn't it have answers in the back?
If you are not on a Perl course then perhaps you should be. Please do
not take offense when I say if you are at the level where you need to
ask many of this level of question you'd probably beniefit more from
some sort of structured Perl course more than you will from asking odd
isolated questions on Usenet.
(Of course, it could just be you had a mental block, in which case
disregard the above).
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\