Therefore I must be doing something wrong.
I am trying to populate an array using split with a regexe.
Here is the code (snippet only).
Expand|Select|Wrap|Line Numbers
- my $date = $q->param('date'); # 20090112 format
- @dateArray = split(/(\d{4})(\d{2})(\d{2})/, $date);
BUT if I try to access a particular indice nothing shows up. ???
example:
Expand|Select|Wrap|Line Numbers
- # After above code
- for(@dateArray){
- print $_, "\n";
- }
- # This works printing 2009 \n 01 \n 12 \n
- # BUT....
- print $dateArray[0]; # OR...
- print "$dateArray[0]";
- # Prints nothing to the screen.
I really need the three individual values, NOT the whole array.
Is there a better what to accomplish this without split?
I just need to pass a number, and be able to use the parts separately.
thanks in advance!