Here's I want to archive. I want to split a one-liner comma-separated and insert @domain.com then join it back as comma-separated.
The one-liner contains something like:
username1,username2,username3
and I want to be something like:
So my Perl script that I tried which doesn't not work properly:
my $var ='username1,username2,username3';
my @tkens = split /,/, $var;
my @user;
foreach my $tken (@tkens) {
push (@user, "$tken\@domain.com");
}
my $to = join(',',@user);
Is there any shortcut on this in Perl and please post sample please. Thanks