Another Newbie responding .....
or, if you wanted the first "word" in $part1 (not necessairly the first 4 characters)
you could do:
@list = split(/ /, $part1);
$part2 = $list[0];
Here you split the $part1 variable on whitespace. The individual strings are then
placed in a "list array" called @list. The first element of @list contains "this".
-ty
>>> <[EMAIL PROTECTED]> 09/25/01 11:41AM >>>
(Newbie responding)
(Newbie responding)
I think:
$part2 = substr($part1, 0, 4);
That's string, position from which to start, length
The parentheses aren't technically necessary; I just like them...
-J
Greg.Froese@Fe
derated.CA To: [EMAIL PROTECTED]
cc:
09/25/01 10:32 Subject: parsing strings
AM
Hi,
I've been programming for a number of years, but I'm VERY new to Perl, and
it looks like a lot of fun. However, I'm very much in the learning stage,
so please be patient, I'm still learning all the keywords etc...
I'm curious how I can parse part of one variable into another
ex:
$part1 = "this is a great day"
# I want $part2 = the first four letters of $part1 (this)
how would I do this?
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]