in reply to Error while using POSIX strftime

This code doesn't compile, and when I add the missing my, the code works for me. Please post code that compiles and reproduces the problem.

Note that you probably want to use print instead of printf.

Replies are listed 'Best First'.
Re^2: Error while using POSIX strftime
by sravs448 (Acolyte) on Sep 16, 2014 at 20:18 UTC
    Yes. It throws the same error after adding "my" as well. Updated the code. But I am still getting the same error.

      Item 2 and 4 on the Basic debugging checklist: look at your data.

      use strict; use warnings; use POSIX qw(strftime); my @lt = localtime; use Data::Dumper; print Dumper(\@lt); my $datestring = strftime "%B %d %Y", @lt; print("date - $datestring\n");

      Please post the output.

      What version of Perl are you using? Perhaps it is a bug in an old version of POSIX
      perl -v
        version 5.16.3