| zOrK | sorry. |
| pontix | RPDrake: that gives you warnings if you access elements you haven't explicitly defined |
| Ani-_ | zOrK: doesn't matter. The solution remains the same |
| pontix | an undef value defaults to zero right? |
| Ani-_ | pontix: not quite |
| pontix | but you still get a warning if you use warnings |
| Ani-_ | pontix: an undef value is false. 0 is false. But 0 != undef. |
| RPDrake | pontix: how would you access non-existent elements? |
| Ani-_ | s/!=/is not the same as/; |
| pontix | well if you had a sparse array and values that haven't been set should be 0 |
| Ani-_ | pontix: basically: if you use an undefined value in a numeric context it will be treated as if it were 0. |
| RPDrake | eval: my @array; @array[5]; |
| buubot | RPDrake: |
| Ani-_ | pontix: if you use it in a string context it will be treated as the empty string |
| pontix | Ani-_: but you get a waring right? |
| Chris62vw | RPDrake, of course you mean $array[5] |
| Ani-_ | RPDrake: $array[5]. @array[5] is an array slice of one element. Which is pointless. pontix: if you enable warnings yes |
| RPDrake | eval: my @array; $array[5]; |
| buubot | RPDrake: |
| RPDrake | yeah |
| apr5 | eval: $_ = "One Two Three"; m/^([^ ]+) +([^ ]+)/; print $2." ".$1; |
| buubot | apr5: Two One 1 |
| apr5 | eval: $_ = "One Two Three"; m/^([^ ]+) +([^ ]+)/; $2." ".$1; |
| buubot | apr5: Two One |
| pontix | Ani-_: if enable warnings, i need to do an explicit check then... |
| Ani-_ | apr5: make sure to always check the return value of your regex before using $1, $2, ... in real code. |
| apr5 | mmmm any ideas why's thats not doing Three One Two? |
| RPDrake | btw whats so great about python? |
| pontix | unless i don't mind a warning RPDrake: dicts for one |
| hobbs | apr5: because you told it not to |
| Ani-_ | pontix: Or you can set the initial value of the variable to 0? or ""? or...? |
| apr5 | Ani-_: kk |
| buu | apr5: Because you only return $1 and $2? |
| apr5 | hobbs: ? but doesnt the first bracket match any words? |
| hobbs | apr5: no |
| Ani-_ | apr5: perldoc perlretut # look for greed or maximal |
| hobbs | apr5: it matches a leading sequence of non-spaces |