0

Hi all,
I'm beginner in Perl. I need to concatenate three values in the date format like,

$fullDate = $ARGV[3] . "/" . $ARGV[4] . "/" . $ARGV[5];

But while concatenating, it is performing division on values. I have tried '.',':','-'. But its not working.
Pls suggest me how to proceed.

3
Contributors
4
Replies
5
Views
10 Years
Discussion Span
Last Post by KevinADC
0

Hi,
Again its performing division only. Pls suggest me how to proceed.

0
$fullDate = join( "/", "$ARGV[3]", "$ARGV[4]", "$ARGV[5]");

or

$fullDate = "$ARGV[3]" . "/" . "$ARGV[4]" . "/" . "$ARGV[5]";

you might want to do $ARGV[5] += 1900; before hand, though.

Edit: And really, you're not trying very hard yourself, if you don't even give something this simple a try.

Edit again: And don't forget to do $ARGV[4]++; beforehand as well, since month is, of course, zero based (i.e. Janauary is 0 not 1).

Edit a third time: Of course, the math opertions are only needed if those values are coming from a localtime() or gmtime() call, rather than from user input, or some other source where the values may already be properly adjusted.

0

plus this question is cross-posted on another perl forum where it has many replies. The OP obviously has no clue, there is no way the code posted would perform division. The forward slashes are strings not operators.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.