hai Alan
Thank you for the reply
but this is not what i asked for,,
array should be created with the number
like this @5 or some thing like @y5 where 5 is the $value
if i give some thing like this @y$value it is giving me an error.


Chaitanya


On Wed, Jun 30, 2010 at 10:40 AM, Alan Haggai Alavi <
alanhag...@alanhaggai.org> wrote:

> On 30 June 2010 10:31, Chaitanya Yanamadala <dr.virus.in...@gmail.com>
> wrote:
> > Hai
> >  i am in a situation like i have a scalar $value = 5
> > now i need to create an array with the number i mean $value
> > how can i do it??
> >
> > regards
> > Chaitanya
> >
>
>
> Hi Chaitanya,
>
> I am not sure if I understood your question well or not.
>
> To create an array with the value, either push or unshift the value
> into an existing array, or assign the value as an array item.
>
> #!/usr/bin/env perl
>
> use warnings;
> use strict;
>
> my $value = 5;
> my @values;
>
> # different cases:
> # push @values, $value;
> # unshift @values, $value;
> # @values = ($value);
>
> __END__
>
> Please refer `perldoc -f push` and `perldoc -f unshift`.
>
> Regards,
> Alan Haggai Alavi.
> --
> The difference makes the difference
>

Reply via email to