Hacker News new | past | comments | ask | show | jobs | submit login

It's actually "if x { y }" in Perl rather than "if x then y". This favours blocks of multiple expressions whereas "y if x" is good for a simple single expression.

A lot of the Perl branching and looping directives provide both methods so you can choose what you prefer.

Having both ways is great for the Perl one-liners :

    cat file | perl -e 'while (<>) {next if /^SKIP /; print if /<fancy regex>/;}'



Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: