Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- #
- # The traditional first program.
- # Strict and warnings are recommended.
- use strict;
- use warnings;
- use diagnostics;
- use feature qw(say);
- my $locatie = $ARGV[0]; # store the 1st argument into the variable
- my %burenlijst;
- my $x;
- my $y;
- open(my $svg, '<', $locatie);
- #print <$svg>; # print file contents
- my $lijn;
- while(my $lijn = <$svg>){
- if($lijn =~/<title>/){
- if($lijn =~/(\d+).by.(\d+)/){
- print($1);
- print($2);
- $x = $1;
- $y = $2;
- }
- }
- if($lijn =~/<text/){
- print($lijn);
- }
- }
- my $teller = 0;
- my $ix = 0;
- my $iy = 0;
- for($iy = 0; $iy< $y;$iy++){
- for($ix = 0; $ix<$x;$ix++){
- $teller++;
- print($teller + " ");
- my @buren;
- my $linkerbuur = 0;
- my $rechterbuur = 0;
- my $bovenbuur = 0;
- my $onderbuur = 0;
- if($teller % $x != 0){
- $rechterbuur = teller +1;
- if($teller - 1 % $x != 0 ){
- $linkerbuur = teller-1;
- }
- }
- if($teller)
- $burenlijst{$telelr} = [@buren];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement