Try using this code
$var = "12 Ali Engineer B889 Middle town USA"; $var =~ s/(\S*)\s*(\S*)\s*(\S*)\s*(\S+)*/$1,$2,$3,$4/; $var =~ s/\s+//g; print $var . "\n";
In reply to Re: replace and remove spaces
by aantonyselvam
in thread replace and remove spaces
by sufi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |