hi tony,
with regard to your code:
s/,//;
That will remove all the commas, leaving you with string "12345"
$variable = ",1,2,3,4,5";
$varaible =~ s/^,+//g;
will remove any number of leading commas.
Hmmmm ...
C:\Home\asu1\UseNet\clpmisc> type crap.pl
use strict;
use warnings;
my $variable = ",1,2,3,4,5";
$varaible =~ s/^,+//g;
print $variable;
C:\Home\asu1\UseNet\clpmisc> crap.pl
Global symbol "$varaible" requires explicit package name at C:\Home\asu1
\UseNet\clpmisc\crap.pl line 5.
Execution of C:\Home\asu1\UseNet\clpmisc\crap.pl aborted due to
compilation errors.
Please make sure your code is valid before you post. The easiest way to
catch this mistake would have been to make sure you had
use strict;
in your script as the posting guidelines recommend.
Second point: You are only removing a leading sequence of commas. By
definition, there can only be one leading sequence of commas. Why do you
think you need the g option above?
use strict;
use warnings;
my $v = ",,,,,,,,,,,,,,,,,,,1,2,3,4,5";
$v =~ s/^,+//;
print $v;
__END__
C:\Home\asu1\UseNet\clpmisc> crap.pl
1,2,3,4,5
Sinan