On bash I did
#!/bin/bash
DATE=`date +%m%y`
echo $DATE
on perl I try this one
#!/usr/bin/perl
$date=`date +%m%y`;
print "date";
And give me..date string and not correct date.
Use localtime()
function:
#!/usr/bin/perl
use strict;
use warnings;
my $date = localtime();
print "$date";
Or :
#!/bin/bash
DATE=`date +%m%y`
echo $DATE
sample output:
1217
should be:
#!/usr/bin/perl
use strict;
use warnings;
use POSIX qw(strftime);
my $date=`date +%m%y`;
print "$date";
sample output:
1217
use print "$date";
instead of print "date";
$var = qx( command )
print "$date", "\n";