I
Ian Wilson
I have some data in the form of a string that contains values delimited
by a character. As obtained, the number of delimiters is variable. I
need to change this so that the number of delimiters is always the same
- by appending delimiters as needed.
I tried the following but was wondering if there is a better approach
that doesn't produce warnings.
#!/usr/bin/perl
use strict;
use warnings;
my $list = 'a,b,c,d';
my ($a,$b,$c,$d,$e,$f) = split (/,/,$list);
$list = join (',', $a,$b,$c,$d,$e,$f);
print $list,"\n";
Use of uninitialized value in join or string at ./idw.pl line 8.
Use of uninitialized value in join or string at ./idw.pl line 8.
a,b,c,d,,
by a character. As obtained, the number of delimiters is variable. I
need to change this so that the number of delimiters is always the same
- by appending delimiters as needed.
I tried the following but was wondering if there is a better approach
that doesn't produce warnings.
#!/usr/bin/perl
use strict;
use warnings;
my $list = 'a,b,c,d';
my ($a,$b,$c,$d,$e,$f) = split (/,/,$list);
$list = join (',', $a,$b,$c,$d,$e,$f);
print $list,"\n";
Use of uninitialized value in join or string at ./idw.pl line 8.
Use of uninitialized value in join or string at ./idw.pl line 8.
a,b,c,d,,