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
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
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
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Stupid question! In reply to
After I went to all that effort too...ugh!