gave the following output in no time.#!/usr/bin/perl use warnings; use strict; #My First Reference called ref1.pl!! my $array = [qw(this is a test to check anonymous arrays)]; print "@{$array}\n"; print "$array->[3]\n"
C:\perl\practice>perl ref2.pl this is a test to check anonymous arrays test
Well, if the disk i/os are causing that then that could be a problem for me..... I wanted to create a refence to an anonymous array so that it can hold command line outputs and I can play around with it.....I tried it with ping localhost command and that took even longer...say about 6 seconds..... May be I shouldnt use reference to anonymous arrays for storing command line outputs..cause that wont be a good way to deal with it.
Note - I wanted to make an anonymous array with words in it...I tried qw [this is a test to check anonymous arrays]but Perl told me something like "Useless use of a constant..."...so I tried some other ways and finally tried [qw(this is a test to check anonymous arrays)] and that seems to work.
Is that the right way of creating a reference to an anonymous array with words in it?In reply to Re^2: why is my reference taking a while to execute?
by perl514
in thread why is my reference taking a while to execute?
by perl514
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |