in reply to Appending characters to an existing string

Can I have a go? :)

First up, nice and short:

$a .= ".pl";
then of course there's the ever faithful:
$a = "$a.pl";
then of course we could get a little tricky:
$a = pack("A*A*",$a,".pl");
or just plain ridiculous:
my $x = sub {return shift() . shift()}; $a = &$x($a,".pl");
and onto the sublime:
$a=~s#$#.pl#;
rdfield

Replies are listed 'Best First'.
Re: Re: Appending characters to an existing string
by Sihal (Pilgrim) on Nov 22, 2002 at 10:34 UTC
    I like the last one.