in reply to Convert Time to Epoch Using External Variable

You can use the numbers as arguments instead of reading them from the standard input:
perl -MPOSIX -e 'print mktime @ARGV' -- 56 34 12 4 1 115

If you need to use the standard input and the comma separated format, use split:

echo 56,34,12,4,1,115 | perl -MPOSIX -e 'print mktime split /,/, <>'
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^2: Convert Time to Epoch Using External Variable
by QM (Parson) on Feb 04, 2015 at 15:08 UTC
    Note the use of -- to tell perl (the executable) to pass the remaining arguments to the Perl script (in this case, given by -e). See Command Switches.

    -QM
    --
    Quantum Mechanics: The dreams stuff is made of

      I think the -- flag to stop option parsing is only necessary if something you want treated as an argument actually looks like it might be an option, e.g. -999 or --foo. In the code given it is not required but it does no harm and using it is not a bad habit to get into.

      $ perl -MPOSIX -le 'print mktime @ARGV' -- 56 34 12 4 1 115 1423053296 $ perl -MPOSIX -le 'print mktime @ARGV' 56 34 12 4 1 115 1423053296 $

      I hope this is of interest.

      Cheers,

      JohnGG

Re^2: Convert Time to Epoch Using External Variable
by Anonymous Monk on Feb 04, 2015 at 15:03 UTC

    Thank you for your help!

    The @ARGV seems like the best option for me.