Thread print @array (Ausgabe gruppieren)
(15 answers)
Opened by Robin G. at 2014-07-22 16:08
PERL-5.10 U:\>perl
use strict; use warnings; my @array = 1..100; print join(", ", @array) =~ s/(\d+, ){3}/$&\n/gr; Bareword found where operator expected at - line 3, near "s/(\d+, ){3}/$&\n/gr" ^Z Can't modify join or string in substitution (s///) at - line 3, near "s/(\d+, ){3}/$&\n/gr" syntax error at - line 3, near "s/(\d+, ){3}/$&\n/gr" Execution of - aborted due to compilation errors. Die Option r bei Regex gibt es in Perl 5.10.1 nicht. Siehe http://perldoc.perl.org/5.10.1/perlreref.html Die existiert erst in 5.14. Last edited: 2014-07-23 10:07:37 +0200 (CEST) |