Try this.
my $text = "Browser/Version Platform";
my ($keep,$discard) = split / /, $text;
print "$keep\n";

This splits on space and saves the part you want to the variable $keep and 
the rest to $discard.

Also you could use a regular expression like such:

my $text = "Browser/Version Platform";
$text =~ /(.+)\s.+/;
print "$1\n";

This matches any character (one or more, indicated by +) before a space 
(\s)  and saves the characters before the space into a global variable $1 - 
called  a backreference which can than be referred to later on.

Good luck!



At 02:14 PM 5/22/01 -0400, you wrote:
>I need a way to return the start of a line up to the first whitespace.
>
>eg
>Browser/Version Platform
>
>I want just the Browser/Version information returned. It should be simple,
>but for some reason the solution eludes me.

Peter Cline
Inet Developer
New York Times Digital

Reply via email to