On Apr 17, 2006, at 10:30, Irfan J Sayed wrote:
Hi,
I have a following line stored in one variable $test.
deliver.Admin_Irfan_Project.20060413.212355 . I need to split this
line
into the words and store the output in array.
words should like this.
deliver
admin
irfan
project
20060413
212355
I am using following code to split this line
$test =~ s/^\s+//;
@array = split(/\W/, $test);
Problem is that "_" belongs to \w or, equivalently, it does not
belong to \W. For that particular example it is enough to include "_"
in the regexp:
% perl -wle 'print for split /[\W_]/, "deliver.Admin_Irfan_Project.
20060413.212355"'
deliver
Admin
Irfan
Project
20060413
212355
-- fxn
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>