Umar Draz wrote:
> Hello Steve
> 
> Thanks for your help.
> 
> Would you please help me one thing more
> 
> I have string e.g
> 
> $str = "Hello this is my string (1020p0404), this string is not complete
> (1 034 400 3). now the string complte";
> 
> I want to remove spaces form within ( ) not whole string. Please help me
> how I can do that.

Undoubtedly, there are far better ways to do this, but this is what I
came up with quickly:

#!/usr/bin/perl

use warnings;
use strict;

my $str = "" .
"Hello this is my string (1020p0404), this string " .
"is not complete (1 034 400 3). now the string complte";

while ($str =~ /\((.*?)\)/g) {

    next unless $1;
    my $num = $1;
    $num =~ s/\s+//g;

    print "$num\n";
}

print "$str\n";

__END__

Output:

1020p0404
10344003
Hello this is my string (1020p0404), this string is not complete (1 034
400 3). now the string complte

Steve

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to