[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

RE: [FWP] appending to two strings




: > > Is there a way to do the following two lines in one line? :
: > >
: > > $string1 .= $append;
: > > $string2 .= $append;
:
: i always thought the "." operator was higher overhead becasue it had
: more storage management.  why not:

That's my understanding, too, but ...
 
: 	( $a, $b ) = map { "$_$append" } ( $string1, $string2 );

... isn't equivalent to the .= problem that was originally posted. You're
making two *new* vars that represent the result of appending $append,
instead of actually appending $append to the original variables. Besides, I
shy away from using $a and $b because they are package globals used by sort.
Or were you just being Lazy and saving keystrokes? :-)

That said, 

	($string1, $string2) = map {"$_$append"} ($string1, $string2);

Regards,
________________________
Eli Evans
Text Preparation Manager
Libronix Corp.
mailto:eli@libronix.com
http://www.libronix.com
Ec 12:12; Jn 21:22



==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe