PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Andrew Armstrong <andrew at qdebit dot com>
Subject: Re: splitting a field by an unrecognizable null field
Date: Sep 25 2000 11:07AM

> When using the split function, to return to an array.
> Add parenthesis as follows:
> ($first, $last) = split(/\s/, $name);
> print "s   first=$first last= $last name= $name \n";
> Brian

In the above example if the fname and lname were seperated by more that one 
space you would get back strange results. So change the regex to look for 1 or 
more spaces .

for example

($first , $last , $other) = split(/\s+/ , $name , 3) ;
print "s+ first=$first  last=$last other=$other  name=$name \n" ;


-------------------------------------------------------------------------------
Andrew Armstrong                                          andrew@qdebit.com
Chief E-Commerce Engineer                                 http://www.qdebit.com
AMIS , LLC.