fork download
  1. #!/usr/bin/perl
  2. # your code goes here
  3.  
  4. print "Start\n";
  5. $num_ports = 3;
  6. $log2_ports;
  7. my @arr = ();
  8.  
  9. while ($num_ports > 0) {
  10. $num_ports = $num_ports >> 1;
  11. $log2_ports++;
  12. }
  13.  
  14. foreach $i (3..0){
  15. print "Loop\n";
  16. $port_i_en = 1 << $i;
  17. print "Port enable: $port_i_en \n";
  18. }
  19.  
  20. foreach $i (0..3){
  21. print "Second Loop $i \n";
  22. push @arr, (($i > 1) ? $i * 10 : $i);
  23. }
  24.  
  25. print join(", ", @arr);
  26. #print $num_ports;
  27. #print $log2_ports;
  28. print "Done";
Success #stdin #stdout 0.01s 5284KB
stdin
Standard input is empty
stdout
Start
Second Loop 0 
Second Loop 1 
Second Loop 2 
Second Loop 3 
0, 1, 20, 30Done