Hi, First off, my apologies if my question is phrased wrong... I am trying to work on the following script:
#!/usr/bin/perl use warnings; use strict; #My First Reference called ref1.pl!! my $array = [`DIR`]; print "@{$array}\n";
Thing is, the moment I hit enter after typing  perl ref1.pl, it takes about 3 to 4 seconds for the output to appear. So I tried using the debugger and found out that the seconds are consumed at the line where  my $array = [`DIR`]; appears....
C:\perl\practice>perl -d ref1.pl Loading DB routines from perl5db.pl version 1.33 Editor support available. Enter h or `h h' for help, or `perldoc perldebug' for more help. main::(ref1.pl:5): my $array = [`DIR`]; DB<1> l 5==> my $array = [`DIR`]; 6: print "@{$array}\n"; DB<1> s
This is where it takes about 3 seconds and then the following line appears. After that, everything is put out on the screen pretty fast.
main::(ref1.pl:6): print "@{$array}\n"; DB<1> s main::(ref1.pl:6): print "@{$array}\n"; DB<1> s Volume in drive C is PC COE Volume Serial Number is 2EB6-FC84 Directory of C:\perl\practice 12/11/2011 12:39 AM <DIR> . 12/11/2011 12:39 AM <DIR> .. 12/09/2011 12:27 AM 303 each.pl 12/09/2011 12:16 AM 271 hashcolor.pl 12/10/2011 01:31 PM 468 Perl-1.pl 12/10/2011 02:13 PM 534 Perl-2.pl 12/10/2011 05:28 PM 223 Perl-4.pl 12/09/2011 12:34 AM 301 Perl-5.pl 12/11/2011 12:39 AM 112 ref1.pl 7 File(s) 2,212 bytes 2 Dir(s) 445,457,670,144 bytes free Debugged program terminated. Use q to quit or R to restart, use o inhibit_exit to avoid stopping after program termination, h q, h R or h o to get additional info. DB<1> s Use `q' to quit or `R' to restart. `h q' for details. DB<1> q C:\perl\practice>
Is this expected behaviour when I use an anonymous reference? Am I doing something wrong here? I have installed 32 bit Activestate Perl on my 64 Bit Windows 7 laptop. Could that be a reason? I have the 64 bit version too, but since the servers on which I plan to run my scripts from is 32 bits, I thought its better to install a 32 bit version. Please let me know.

In reply to why is my reference taking a while to execute? by perl514

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.