Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Perl Beginners > Extracting data...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 10734 of 11982
Post > Topic >>

Extracting data from a string

by andrewmchorney@[EMAIL PROTECTED] Mar 14, 2008 at 04:46 PM

Hello

I have a string that I am trying to parse out into separate variables. I
am having problems getting the first field extracted. I want to extract
fields using period (.) and underline (_) delimineters.

Here is the string

aaa_b_ccccc_.ddd

The string is contained in $_.

Here is my code 

($a, $b, $c, $d, $e, $e) = (split /_|\./)[1,2,3,4,5,6];

I am not getting the "aaa". I am getting b when I should be getting a.

Andrew
 




 3 Posts in Topic:
Extracting data from a string
andrewmchorney@[EMAIL PRO  2008-03-14 16:46:41 
Re: Extracting data from a string
krahnj@[EMAIL PROTECTED]   2008-03-14 13:53:29 
Re: Extracting data from a string
rvtol+news@[EMAIL PROTECT  2008-03-15 14:02:24 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Oct 11 1:42:10 CDT 2008.