[Vienna-pm] regex-foo

Thomas Klausner domm at cpan.org
Wed Jun 7 07:00:21 PDT 2006


Hi!

Ich bin hier grad auf dieses "Problem" gestossen (worden):

  my $string="Use Python";
  (my $besser=$string)=~s/Python/Perl/;
  print $besser;

  Use Perl

passt.

  my $string="Use Python";
  say((my $besser=$string)=~s/Python/Perl/);
  sub say { print @_ }

  1

passt nicht, was ja auch klar ist.

Eingentlich war gefragt, ob sowas geht:

  my $string="Use Python";
  say(($string)=~s/Python/Perl/);
  sub say { print @_ }

  Use Perl

Also ein Replace mit eine Regex, wobei der modifizierte String an eine Funktion uebergeben werden soll ??

-- 
#!/usr/bin/perl                               http://domm.zsi.at
for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/}


More information about the Vienna-pm mailing list