Thanks Andrew and Jeff.
($cmd1, $rest)=split/\s+/,cmd$; worked for me. 
my ($cmd1) = split/\s+/,$cmd;  is still giving me the length...
I wanted to use something like above ...
Jeff,

Is there any thing else I need to change in the line...

Thanks

----- Original Message -----
From: Andrew Curry <[EMAIL PROTECTED]>
Date: Thursday, September 20, 2007 5:33 pm
Subject: RE: White space split
To: [EMAIL PROTECTED], beginners@perl.org


> Split returns an array 
> So you need to do something like
> 
> #!/bin/perl
> $cmd="maheshverama           #XXXXXXXXXXXXXXXXXXXXXX#";
> ($key,$value)=split(/\s+/,$cmd);
> print "$key, $value\n"; 
> 
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
> Sent: 20 September 2007 12:56
> To: beginners@perl.org
> Subject: White space split
> 
> Hello,
> 
> I am trying to do this
> 
> #!/bin/perl
> $cmd="maheshverama           #XXXXXXXXXXXXXXXXXXXXXX#";
> $cmd1=split /\s+/,$cmd;
> print $cmd1;
> 
> Wanted the first part to be taken its giving me some numbers as output.
> 
> Thanks
> Manoj
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional
> commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
> 
> 
> 
> This e-mail is from the PA Group.  For more information, see
> www.thepagroup.com.
> 
> This e-mail may contain confidential information.  Only the addressee 
> is
> permitted to read, copy, distribute or otherwise use this email or any
> attachments.  If you have received it in error, please contact the sender
> immediately.  Any opinion expressed in this e-mail is personal to the 
> sender
> and may not reflect the opinion of the PA Group.
> 
> Any e-mail reply to this address may be subject to interception or
> monitoring for operational reasons or for lawful business practices.
> 
> 
> 
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> http://learn.perl.org/
> 
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to