in reply to splitting a number into several numbers

It's unclear what you really want. I mean, if you just have this number, and all you need is 12, 34 and 45, you could do:
my ($var1, $var2, $var3) = (12, 34, 45);
But what do you want to do in the general case? Always end up with three numbers? Always get a list of 2 digit numbers?

In the former case, I'd use substr:

my $str = 123445; my $l = int (length ($str) / 3); my $var1 = substr $str, 0, $l; my $var2 = substr $str, $l, $l; my $var3 = substr $str, 2 * $l;
In the latter case, a regex will do:
my @vars = $str =~ /..?/g;
Next time, be more precise in what you want. And having a working example helps too (123345 isn't "12" . "34" . "45").

Abigail

Replies are listed 'Best First'.
Re: Re: splitting
by kidd (Curate) on Jul 05, 2002 at 13:18 UTC
    Im sorry...I had a typo...I meant it to be 12 33 and 45...and yes I meant in a general case, and THAT was an example...

    But thanks for your reply...that's what I was looking for...