Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
Sebbe
Feb 29, 2004

Rohaq posted:

But to my other question: Anybody got any favourite regex testers in here?
I'm quite fond of RegexBuddy. I've use it so many times for debugging regexes, and it supports a ton of different regex implementations.

Adbot
ADBOT LOVES YOU

Sebbe
Feb 29, 2004

Hughmoris posted:

Does anyone have any recommended readings or tips for learning how to scrape a webpage with perl?

My personal go-tos for that are WWW::Mechanize and HTML::Query.

As an example, here's a recent thing I made, which scrapes some messages from a login-protected site to a JSON API.

Sebbe
Feb 29, 2004

Hughmoris posted:

I can't say I really understand what's going on here: while (my @vals = $it->())

When you call natatime , you get back a (reference to a) subroutine. Whenever you call this subroutine (i.e., the $it->() call), it gives you the n (in this case 3) next elements of the list you provided. The while-loop then terminates once there are no more values to return, since the empty list is a falsy value.

If you're curious, you can see the implementation here.

Sebbe
Feb 29, 2004

Mithaldu posted:

For the intermediate arrow though, there is concensus. Generally only those who don't know about its optionality leave it in.

I didn't know about this. So, dereferencing arrows are optional precisely when?

Sebbe
Feb 29, 2004

I thought I'd share a small tool I find useful: perlopen

It's basically just a small script that searches your include path for a specific package, and opens it in your editor. E.g. perlopen WWW::Mechanize

Saves you some time from searching for the file if you want to, say, inspect the source of an installed CPAN module or whatnot.

Sebbe
Feb 29, 2004

For anyone who hasn't seen it; there are livestreams of YAPC::NA on their YouTube channel.

Adbot
ADBOT LOVES YOU

Sebbe
Feb 29, 2004

Mithaldu posted:

To be honest, i'm not entirely sure much world-shifting stuff happened?

post-fix deref is amazing if you can know you'll work on new perls

autoderef is dead and gone

Other than that, i'm not really aware of much that i can actually use.

Subroutine signatures are pretty nice, too.

And there's also the double diamond operator, which is worth knowing about, I suppose.

  • Locked thread