I tried a small test :
to replace x
in x|y|z|a
with w
so i tried:
echo "x|y|z|a" | perl -lne '@arr=split /|/;$arr[0]='w';$_=join "|",@arr;print $_;'
it gave me:
> echo "x|y|z|a" | perl -lne '@arr=split /|/;$arr[0]='w';$_=join "|",@arr;print $_;'
w|||y|||z|||a
>
surprisingly it gave 3 field separators instead of one. can anybody tell me where am i wrong?