| perlbot | unicode doesn't have any karma |
| froggytroat | my $logfile = $opt{l} or $arg_list->{l}[2]; This gives me a warning, Useless use of array element in void context any suggestions? if I use || instead of or, it works fine. |
| LeoNerd | Yes. ( my $logfile = $opt{l} ) or ( $arglist->{l}[2] ) ^-- that's how it parses. or is very low precidence; lower even than = |
| tybalt89 | eval: $_ = "HONG KONG"; s/\w+/\u\L$&/g; $_ |
| buubot | tybalt89: Hong Kong |
| poppyer | hi, does perl have some kind of array filter function. like @a=filter(@b, "x>=3") say |
| LeoNerd | my $value = thing() or die "..."; my $value = thing() || "default"; is generally how you'd use them |
| froggytroat | LeoNerd: Thanks, so it's actually evaulatign $arglis->{l}[2] and doing nothing with it, right? |
| tybalt89 | poppyer: grep() |
| froggytroat | and that's why it's complaining |
| LeoNerd | froggytroat: Basically, yup |
| froggytroat | thanks |
| poppyer | tybalt89, the array @a is basically numbers, and i want to apply a bool function f(x) as the conditions |
| LeoNerd | eval: @numbers_above_ten = grep ( sub { $_ > 10 }, ( 1, 10, 13, 5, 7, 14 ); \@numbers_above_ten |
| buubot | LeoNerd: Error: syntax error at eval line 1, at EOF |
| LeoNerd | eval: @numbers_above_ten = grep ( sub { $_ > 10 }, ( 1, 10, 13, 5, 7, 14 ) ); \@numbers_above_ten |
| buubot | LeoNerd: [1,10,13,5,7,14] |
| LeoNerd | Err.... eval: @numbers_above_ten = grep { $_ > 10 } ( 1, 10, 13, 5, 7, 14 ); \@numbers_above_ten |
| buubot | LeoNerd: [13,14] |
| LeoNerd | Much better |
| poppyer | thx, i will try :) |
| anno | the sub is always true |
| LeoNerd | Yeah.. |
| anno | sub { $_ > 10}->() |
| tybalt89 | perl -le '@a=qw(1 3 5 4 2 7 6 4 5 2); @b = grep $_ < 5, @a; print "@b"' |
| LeoNerd | Yes, this is grep with its weird magic first argument That somehow knows to defer execution |
| Bogaurd | if i want to run a reverse dns on something, and if it returns a value set $revdns to that string, can i do it in an if() something like this? if (gethostbyaddr(inet_aton($src),AF_INET)) { $revdns = $_; } |
| action | LeoNerd incidentally, would recommend getnameinfo() in Socket6 instead |
| LeoNerd | incidentally, would recommend getnameinfo() in Socket6 instead |
| Bogaurd | i dont quite have the hang of the way things are done in perl |