Click to See Complete Forum and Search --> : ? about perl and qw


hinkbot
02-24-2003, 09:06 PM
i have to do a program for my csci class, and basically what i need to do right now before starting everything else is to use qw to manipulate a line. so this is what i am trying to do...

@states = qw(@filelist[0]);

now what i would hope to happen is that the line at filelist[0] would be passed to qw, but what is actually happening is "@filelist[0]"is being manipulated which is not what i want.

how can i use qw on the information stored at the aforementioned location???

rid3r
02-25-2003, 12:21 AM
@states=@filelist[0]; without qw, my guess is that qw treats @filelist as an ordinary word, not the first value of @filelist array, Perl is odd sometimes.

Hena
02-25-2003, 06:57 AM
If you want first element of @array, then use must do $array[0] not @array[0]. So try
@states=qw($filelist[0]);

Ps. these lines _always_ as first lines
use warnings;
use strict;