Hi, I'm learning to use perl and I made the following code but it doesn't print the variable "aristas" and "clust", would you help me finding why doesn't the code print those variables?

use strict; use warnings; my $nodos; my $n; my $i; my $j; my $l; my $aristas; my $areales; my $clust; my %red=(); $aristas=0; print"Indica el numero de nodos\n"; $nodos=<STDIN>; #aqui se declara la matriz una vez que se sabe el numero de nodos print"Introduzca las conecciones de los nodos.\n"; for($n=0; $n<$nodos; $n++){ for($i=0; $i<$nodos; $i++){ if($n!=$i){ $red{$n}{$i}=<STDIN>; } } } for($n=0; $n<$nodos; $n++){ $aristas=0; for($i=0; $i<$nodos; $i++){ if($n!=$i){ if($red{$n}{$i}==1){ $aristas++; } } } print"la posicion del nodo en escala vector, numero de aristas + y coeficiente de clustering respectivamente:\n"; print"\n$n"; print"\n$aristas"; if($aristas==1||$aristas==0){ print"0\n"; } else{ $areales=0; for($j=0; $j<$nodos; $j++){ if($n!=$j){ for($l=0; $l<$nodos; $l++){ if($j!=$l&&$l!=$n){ if($red{$j}{$l}==1){ $areales++; } } } } } $areales=$areales/2; $clust=(2*$areales)/($aristas*($aristas-1)); print"$clust"; } }

In reply to help :) by Harry_Sor

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.