Gossamer Forum
Home : General : Perl Programming :

Stupid question!

Quote Reply
Stupid question!
Man, don't you hate mind blanks? Its pretty easy what I want to do, but I can't remember the function to call! Basically, I have a list of words, in the form of an string, i.e.

$var = "test work my words";

Now, I need to get those into the @array. How would I go about this? My brain has just gone completly dead! (no comments there Paul please Tongue).

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Stupid question! In reply to
Sorry I can't help but comment. A blank is one thing but it's like you have a black hole in the side of your brain Wink

my @words = split /\s+/, $var;

That what you want?

Or more accurate....

my @words = grep { /^\w+$/ } split /\s+/, $var;

Last edited by:

Paul: Sep 6, 2002, 8:46 AM
Quote Reply
Re: [Paul] Stupid question! In reply to
Man..thats it. For some reason I had join() in my head Unsure Turns out I didn't need this option anyway...but thanks for the reply :P

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Stupid question! In reply to
After I went to all that effort too...ugh!