Advertisement
Guest User

Untitled

a guest
May 10th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.00 KB | None | 0 0
  1. #!/usr/bin/perl
  2. #
  3. # The traditional first program.
  4.  
  5. # Strict and warnings are recommended.
  6. use strict;
  7. use warnings;
  8. use diagnostics;
  9. use feature qw(say);
  10.  
  11. my $locatie = $ARGV[0];           # store the 1st argument into the variable
  12. my %burenlijst;
  13. my $x;
  14. my $y;
  15. open(my $svg, '<', $locatie);
  16. #print <$svg>; # print file contents
  17. my $lijn;
  18. while(my $lijn = <$svg>){
  19.     if($lijn =~/<title>/){
  20.         if($lijn =~/(\d+).by.(\d+)/){
  21.             print($1);
  22.             print($2);
  23.             $x = $1;
  24.             $y = $2;
  25.         }
  26.        
  27.     }
  28.     if($lijn =~/<text/){
  29.         print($lijn);
  30.     }
  31.  
  32.  
  33. }
  34. my $teller = 0;
  35. my $ix = 0;
  36. my $iy = 0;
  37. for($iy = 0; $iy< $y;$iy++){
  38.    
  39.     for($ix = 0; $ix<$x;$ix++){
  40.         $teller++;
  41.         print($teller + " ");
  42.         my @buren;
  43.         my $linkerbuur = 0;
  44.         my $rechterbuur = 0;
  45.         my $bovenbuur = 0;
  46.         my $onderbuur = 0;
  47.         if($teller % $x != 0){
  48.             $rechterbuur = teller +1;
  49.             if($teller - 1 % $x != 0 ){
  50.                 $linkerbuur = teller-1;
  51.             }
  52.  
  53.         }
  54.         if($teller)
  55.         $burenlijst{$telelr} = [@buren];
  56.        
  57.     }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement