Mallik wrote:
Dear Friends,
Hello,
I have the below code.
my $a = ":-:m:-:a:-:l:-:i:-:k"; # Here each letter is separated by :-:
my $del = ':-:'; # Delimeter
my $b;
while ($a ne $b)
{
$a =~ /^$b$del(.?)($del)?/;
my $c = $1;
print "$c\n";
$b .= $del . $c;
}
The above code is working fine. But when I change the text in $a like below
$a = ":-:m:-:a:-:l:-::-:k"; # Here I removed the letter l between two '::'s
Now the code is not working properly.
Any help in this is appreciated.
Note: There may be non-alpha numeric chars between ':-:'.
Perhaps you need to use split and join:
$a = ':-:m:-:a:-:l:-::-:k';
my $del = ':-:'; # Delimeter
$b = join $del, split $del, $a, -1;
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>