Hey There,
I tripped across on the forums today ( A good place to get ideas for content, for me, is going out and seeing who I can help or who can help me :)
Thought it might be interesting, since I've been writing perl and shell script for so long that I hadn't really considered this since I can't remember when. Hopefully, it's still interesting to others, as well :)
Q. 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.
A. You can do the same thing without concatenating in the "conventional" sense, like this:
$fullDate="${ARGV[3]}/${ARGV[4]}/${ARGV[5]}";
The {} around the variable names may not even be necessary. It's a habit I'm in because it makes sure that perl knows $ARGV[3] is my variable and the following "/" is a character and can't possibly make the mistake of thinking $ARGV[3]/ is the name of my variable.
Hope this helps :)
, Mike
linux unix internet technology
Wednesday, October 17, 2007
Some Simple Perl Concatenation Advice
Posted by Mike Golvach at 9:27 PM
administration, advice, concatenation, linux, perl, script, scripting, technology, tips, unix