6

Once upon a time, you opened files in Perl like so:

open(FH, ">$filename");

At some point, for many good reasons including some very sticky ones involving filenames with leading spaces, this syntax became available (and, immediately, preferred):

open(FH, '>', $filename);

What version of Perl did we get that syntax with?

8
  • 3
    "open my $fh, '>', $filename or die $!" is even more preferred. Commented Feb 5, 2010 at 21:21
  • That isn't really just the open operation, though, that's the open operation plus a form of failure handling that may or may not be appropriate to context. I only wanted to talk about open.
    – chaos
    Commented Feb 5, 2010 at 21:25
  • Is there any particular reason you posted this question & answer? There are lots of changes documented in perldelta and no reason for SO to duplicate those one at a time... Commented Feb 5, 2010 at 23:13
  • I posted it because I was having a hard time finding it. I answered it because I found it.
    – chaos
    Commented Feb 5, 2010 at 23:30
  • 1
    In that vein, I've found corelist (search.cpan.org/dist/Module-CoreList) invaluable for telling me what version of Perl contains a given module. E.g. corelist /File::Spec/ from the command line. Very handy when you're trying to figure out which additional modules you need to install on some other computer. Commented Feb 7, 2010 at 17:55

2 Answers 2

11

Looks like 5.6.0.

7
  • 3
    In other words, Late Jurassic :)
    – DVK
    Commented Feb 5, 2010 at 21:26
  • 4
    Some of my early professional sysadmin tasks were done in Perl 4, when it was new and exciting. You kids get your "fire" and your "wheel" off my grass.
    – chaos
    Commented Feb 5, 2010 at 21:28
  • Aah, I was curious if open my $fh, '>:raw', $filename came about at the same time -- it appears so.
    – ephemient
    Commented Feb 5, 2010 at 21:36
  • ephemient: ':raw' is an io layer, they were added in 5.8.0. Commented Feb 5, 2010 at 22:04
  • 3
    Although you found the answer, how you found the answer is probably the interesting part. So, what did you do? :) Commented Feb 6, 2010 at 4:25
6

When you have those sorts of questions, start crawling back through the perl*delta documents. You can mostly skip the minor versions since those versions shouldn't introduce major features.

In this case, you'd find it in perl56delta.

1

Not the answer you're looking for? Browse other questions tagged or ask your own question.