I've always liked that Perl has a .= operator but I've often wished for the reverse. Why isn't there something nice like $x ,= $y (meaning $x = "$y$x")?
Re
clscott on 2003-09-03T19:59:52
Wouldn't that be =. ?
$x .= $y # $x eq "$x$y"
$x =. $y # $x eq "$y$x"
Re:Re
gav on 2003-09-03T20:12:39
You can't have =. for cases such as $x =.1 which is a shame.
Source Filters?
KM on 2003-09-04T03:56:19
Filter done in 2 minutes.. may not always work :-)
package Foo;
use Filter::Util::Call;
sub import {
my ($type) = @_ ;
my $ref = [] ;
filter_add(bless $ref) ;
}
sub filter {
my ($self) = @_ ;
my $status = filter_read();
if (/\s+=.\s+/) {
s!^(\$[[:alnum:]_]+)\s+=.\s+(\$[[:alnum:]_]+)!$1 = $2 . $1!;
}
$status;
}
1;
Script:
use Foo;
my $foo = " World";
my $bar = "Hello";
$foo =. $bar;
print $foo . "\n";
$zog =.1;
print $zog;