QUOTE(Sun751 @ 25 Jun, 2009 - 10:34 AM)

CODE
$$hash{$id}=~ s/\/opt\/app\/$val.*?://;
In addition to chorny_cpan's comment, you can use pretty much whatever punctuation you want as your regex delimiters (provided you're explicitly stating either the "m" or "s" operator), which can help with avoiding "leaning toothpick syndrome":
CODE
$hash->{$id}=~ s|/opt/app/$val[^:]*:||;
(For more examples of this, including a working demonstration, you can see one of my posts from a couple weeks ago
over on PerlMonks.)
I also changed the .*? to [^:]* because it's a clearer statement of what you want ("any number of non-colon characters, followed by a colon" vs. "the smallest possible number of any characters at all, followed by a colon"). It's generally good practice to avoid .* (or .+) in favor of negated character classes whenever possible, even in cases where just making it non-greedy will work.