my $split_me = 'www.xyz.com'; my $split_char = qr{\.}; $split_me =~ s/$split_char.*$//; # 'www'
Or to just print the value:
print $split_me=~/^(.*?)$split_char.*$/;
In reply to Re: Split returning one element
by keszler
in thread Split returning one element
by MonkDrew
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |