Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Jim Gibson
May 15, 2012, 12:01 am
rate this thread
You should not be assigning a string to an array variable:
my $str = "xxxx:yyyy:zzzz:aaaa::bbbb.9.5";
There is no need for a loop, and you need to escape the period to match
only a period:
my @values = split(/\./,$str);
Your desired string is now in $values.
You could also use a regular expression:
$str =~ s/\..*//;
- » Re: Timeout thread while it is in a system command
- — Next thread in » PERL Discussions
- » Re: What does "__PACKAGE__->_factory" actually do?
- — Previous thread in » PERL Discussions