Re: converting scalar to an array of elements
From: AlV (skweek_at_no.spam)
Date: 02/07/04
- Next message: James Willmore: "Re: converting scalar to an array of elements"
- Previous message: Yash: "Compiler directives for Perl?"
- In reply to: Chuckb: "converting scalar to an array of elements"
- Next in thread: James Willmore: "Re: converting scalar to an array of elements"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 07 Feb 2004 14:55:19 +0100
Chuckb wrote:
> I should know this but, what is the quickest way to convert a scalar value
> into an array?
> Ex: $name="Fred";
> so that
> $arrayname[0]="F";
> $arrayname[1]="r";
> $arrayname[2]="e";
> $arrayname[3]="d";
perldoc -f split
use warnings;
use strict;
my $name="Fred";
my @arrayname = split //, $name;
foreach (@arrayname)
{
print $_, "\n";
}
- Next message: James Willmore: "Re: converting scalar to an array of elements"
- Previous message: Yash: "Compiler directives for Perl?"
- In reply to: Chuckb: "converting scalar to an array of elements"
- Next in thread: James Willmore: "Re: converting scalar to an array of elements"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|