i dont know what is wrong... Im a noob help me please
Code:
#!/usr/bin/perl
use strict;
use warnings;
sub bisplit {
if(length($_)==2){
my @lista = split($_[0],$_[1]);
print (join(":",@lista)),"\n";
}
}
bisplit(/\,/,"12,13,14,15,16");
The "warnings" pragma should be giving you some hints to problems in your code. Also, where is $_ defined in your code?
Code:
if(length([red]$_[/red])==2){
Maybe you mean to do something like this:
Code:
#!/usr/bin/perl
use strict;
use warnings;
sub bisplit {
if ( @_== 2 ){
my @lista = split(/$_[0]/,$_[1]);
print join(":",@lista),"\n";
}
}
bisplit(',',"12,13,14,15,16");
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.