Can anybody please let me know how can I make an array ref out of a scalar variable (equivalent to a hash ref)? The code I have so far is:
#! /usr/bin/perl
use strict;
my $index=0;
my $car={};
$car->{model}[$index]="Tesla";
my $texxt = $car->{model}[$index];
@{$texxt}=qw(1 2 3);
print "@{$texxt}";
This gives the following error: Can't use string ("Tesla") as an ARRAY ref while "strict refs" in use at test99.pl line 8.
Basically I am trying to make an array (or an array ref) called "@Tesla" that has values (1 2 3).
Thanks for your help!
perldsc.