Ur data:

aragonm 172.24.142.136 aupoza528 (v1.1), start Thu 23/5 13:54
salibaj     172.24.142.136 aupoza528 (v1.1), start Thu 23/5 13:54
seniorb    172.24.142.136 aupoza528 (v1.1), start Thu 23/5 13:54


If $str_line contains one line at a time
e.g, $str_line = "aragonm 172.24.142.136 aupoza528 (v1.1), start Thu
23/5 13:54";

U can use:

my ($user) = split (/\s+/, $str_line, 2);

Note: ($user) => context is array and not scalar

If $str_line contains the whole data 
i.e.,

$str_line = "aragonm 172.24.142.136 aupoza528 (v1.1), start Thu 23/5
13:54\nsalibaj 172.24.142.136 aupoza528 (v1.1), start Thu 23/5
13:54\nseniorb    172.24.142.136 aupoza528 (v1.1), start Thu 23/5 13:54
";

U can use:

my @lines = split (/\n/, $str_line);
foreach $var (@lines)
{
        my ($user) = split (/\s+/,$var);
        print "User is :$user\n";
}



Cheers
Mayank

[EMAIL PROTECTED] wrote:
> 
> Hi all,
> 
> I have the following data stored in a variable ($str_line), but I only need the 
>usernames (ie the first column) from this information.  How do i extract just the 
>user names?
> 
>         aragonm 172.24.142.136 aupoza528 (v1.1), start Thu 23/5 13:54
>         salibaj     172.24.142.136 aupoza528 (v1.1), start Thu 23/5 13:54
>         seniorb    172.24.142.136 aupoza528 (v1.1), start Thu 23/5 13:54
> 
> This is what I am currently using, but it just returns all the information.
> 
> my $user = (split (/\s+/), $str_line);
> 
> Any help would be appreciated
> 
> Thanks in advance,
> Melissa
> 
> ------------------------------------------------------------------------------
> This message and any attachment is confidential and may be privileged or otherwise 
>protected from disclosure.  If you have received it by mistake please let us know by 
>reply and then delete it from your system; you should not copy the message or 
>disclose its contents to anyone.
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

-- 
Regards
Mayank

"The difference between ordinary and extraordinary is that little extra"
                                                                  -Anon

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to