Python/C++ vs. Perl/C++

Perl Magic

Here's a little exercise that should demonstrate that Python is a more natural scripting language option for C/C++ programmers (and human beings in general) than Perl. This is but one of many possible examples.

The task: No task here, this one's a bit different, because this illustrates something unique to Perl, and that is the use of "magical variables." These beauties don't even need to appear in your program! Perl Zombies may consider this "elegance," but normal folk would classify this as just another layer of complexity. The issue is perfectly summed up with this quote from an article by Paul Prescod.

When you read code that seems to be operating magically on information that you have not provided, what documentation do you consult to understand it?

Comment on this topic

  if(/some regex/)

Where are the variables? What's going on here? A Perl newbie has no clue and no clue where to start looking.