On Friday 09 July 2004 04:20, [EMAIL PROTECTED] wrote:
> $string =
> "a%3A2%3A%7Bi%3A0%3Bs%3A3%3A%22489%22%3Bi%3A1%3Bs%3A32%3A%22a85a44c18
>81523798bc155a5369e1226%22%3B%7D"
>
> How would I empty $string if it contained more than ten % characters?
> In other words
>
> $string =
> "a%3A2%3A%7Bi%3A0%3Bs%3A3%3A%22489%22%3Bi%3A1%3Bs%3A32%3A%22a85a44c18
>81523798bc155a5369e1226%22%3B%7D"
>
> Would be emptied, while
>
> $string = "a%3A2%3A%7Bi%3A0%3Bs%3A3%3A%22489%22"
>
> would not.

$string = '' if $string =~ tr/%// > 10;


John
-- 
use Perl;
program
fulfillment


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to