Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question regarding a variable in code

Status
Not open for further replies.
Joined
Aug 14, 2008
Messages
38
Location
US
I am not real sure how to word my question, so bare with me. Trying to find information or get pointed to an article that explains what the difference between $debug and $debug. are? What the dot on the end of the variable does, if anything?

$mac=lc($mac);
$debug.=$mac;
$debug.=`./script.expect $mac`;
 
these are the same:

Code:
$foo = 'foo bar';
$foo = $foo . ' baz';

Code:
$foo = 'foo bar';
$foo .= ' baz';

".=" assigns and appends data to the end of an existing string. Other perl operators have similar shortcuts:

+=
*=
/=
||=

and I am sure there are more.




------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
You can find more information in perldoc perlop under the Assignment Operators heading (which can also be found here.)
 

Thanks so much for the information; exactly what I needed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top