in reply to Re: why is my reference taking a while to execute?
in thread why is my reference taking a while to execute?
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?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: why is my reference taking a while to execute?
by cavac (Prior) on Dec 10, 2011 at 21:51 UTC | |
by perl514 (Pilgrim) on Dec 11, 2011 at 07:14 UTC | |
|
Re^3: why is my reference taking a while to execute?
by chromatic (Archbishop) on Dec 11, 2011 at 00:15 UTC |