i want to diide given string in to words w/o using split function but by using \s or \S regexp. i have written code but smetime its working smrtime not...
#!/usr/bin/perl
$xy = "hello hi i need your help"; # it can be anything;
$xy=~/(\w+)/;
print $1; # diz wud print "hi";
$xy =~ /(\s)(\w+)/;
print "$1 \n";
print "$2 \n";
# diz logic wat i used but its very easy wen it would print word or when it wud print space so if any logic to do samething