1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#!/usr/bin/perl use strict; use warnings; use Data::Dumper; local $Data::Dumper::Purity; $Data::Dumper::Purity = 1; local $Data::Dumper::Useqq; $Data::Dumper::Useqq = 1; local $Data::Dumper::Sortkeys; $Data::Dumper::Sortkeys = sub { my ($hash) = @_; return [(sort {lc $a cmp lc $b} keys %$hash)]; }; use 5.010; my $test = sub { my ($teile) = @_; say Dumper($teile); say "in der sub: ".join('/',@{$teile->[0..scalar(@$teile) - 2]}); }; my @teile = split(/[\\\/]/,'http://www.....'); say "ausserhalb: ".join('/',@teile[0..scalar(@teile) - 2]); $test->(\@teile);
Quoteausserhalb: http:/
$VAR1 = [
"http:",
"",
"www....."
];
Use of uninitialized value $. in range (or flip) at test.pl line 19.
Can't use string ("") as an ARRAY ref while "strict refs" in use at test.pl line 19.
say "in der sub: " . join( '/', @$teile[0..scalar @$teile - 2] );