Changing the line:
($fn,$mn,$ln) = split ('',$in);
to:
($fn,$mn,$ln) = split (' ',$in);
(notice the space in the first argument of split)
seems to make it work on my machine.
WinNT w/ activestate perl.
Chris
-----Original Message-----
From: leon Saviski [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 29, 2001 1:27 PM
To: [EMAIL PROTECTED]
Subject: how to use split function to extract data to hash
hi
i am trying to write script that would allow create hash from input that
consists of multiple white spaces. User enters first middle last name like
"John Morton Downey".
part of the code:
while() {
print "enter your first middle last name";
chomp($in=<STDIN>);
if ($in ne '') {
($fn,$mn,$ln) = split ('',$in);
# at this point I am stuck. As true, it retrieves only first and middle
names. I don't want to use substitution option. How to use split on multiple
white spaces?
Any hints?
LeN
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activeperl