Christian Kruse: Warum funktioniert das ?

Beitrag lesen

Hoi,

Keine Sorge, $daten ist und bleibt auch nach dieser Zeile ein
scalar. Du könntest genausogut schreiben

$daten =~ s/testen/blablabla/, $daten, 1, 2, 3;

und PERL meckert nicht.

Das wage ich zu bezweifeln:

H:\Perl\bin>perl -we "$daten = 'xyz'; $daten =~ s/x/y/g, $daten, 1, 2, 3;"
Useless use of a variable in void context at -e line 1.
Useless use of a constant in void context at -e line 1.
Useless use of a constant in void context at -e line 1.

H:\Perl\bin>perl -v

This is perl, v5.6.0 built for MSWin32-x86-multi-thread
(with 1 registered patch, see perl -V for more detail)

Copyright 1987-2000, Larry Wall

Binary build 620 provided by ActiveState Tool Corp. http://www.ActiveState.com
Built 18:31:05 Oct 31 2000

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5.0 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using man perl' or perldoc perl'.  If you have access to the
Internet, point your browser at http://www.perl.com/, the Perl Home Page.

H:\Perl\bin>

Gruesse,
 CK