use strict; my $x = 0; my $y = 0; my $x2 = 0; my $y2 = 0; if (@ARGV >= 0) { $x = shift @ARGV; } if (@ARGV >= 0) { $y = shift @ARGV; } if (@ARGV >= 0) { $x2 = shift @ARGV; } if (@ARGV >= 0) { $y2 = shift @ARGV; } print STDERR "lese Daten ...\n"; my @lines = (); while () { chomp $_; my $l = $_; push @lines, $l; } print STDERR "extrahiere Kachelbereich [$x, $y] ... [$x2, $y2]\n"; my $xstart = $x * 64; my $ystart = $y * 64; my $xend = $x2 * 64 + 64; my $yend = $y2 * 64 + 64; for (my $j = $ystart; $j < $yend && $j < @lines; $j++) { my @cols = split /[\s;,]/, $lines[$j]; for (my $i = $xstart; $i < $xend && $i < @cols; $i++) { if ($i > $xstart) { print ","; } print $cols[$i]; } print "\n"; }