Word up to first space

Hi All,

my string is:

Alabama Tax Experts

I want to take Alabama in one separate variable, means every first element of a string in perl....

please help

what have you tried in Perl? have you read the docs?

yes, but I found nothing useful there... can be possible using split but dont want to use it. please suggest any useful command from unix if possible

what's wrong with using Perl's split. It does the job and does it well. If you can have other alternatives, you can use awk or cut. Search the forum..because parsing columns are very common task and asked a lot of times.

Here's the thing: when you just say you don't want to use split, that makes it sound like homework.

If you gave a legitimate reason for that, we could probably help.

Like - "My @ key is broken right now" or "Yeah, but I'd like to write my own parser and I'm having trouble with..." or "Yeah, but I thought maybe I could do this with "unpack" but I'm confused" or ...

I didnt want to use split because foreach in next step will create complexity in my program and that was I wanted to avoid....

But now I got my solution...

$temp=~ s/ .*//g;

Guys, this was I was expecting....