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

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to