Let's start from choroba's answer (note: I prefere square brackets to print variables): see it here live at WebPerl (WebPerl kindly provided by haukex)
The above works as you expected. But be careful with the * quantifier: it's greedy, very greedy! Learn about greediness at ModernPerl book .. well read all the book as side book while learning perl: it is not designed for beginner but is a great book, and free!
Also notice that you worked on a positive match, but you can also do the opposite: work on negative matches, ie match all non spaces \S like in this example
haukex was so kind to provide also a regex testing page: let's see our last regex against your string and another similar to choroba's one: regex live at webperl
As you can see there is a lot to play with!
HtH
PS if interested you can create links to webperl using my WebPerlizator - automating WebPerl (by haukex) page creation
L*
In reply to Re: Match variables : Beginner in perl -- webperl
by Discipulus
in thread Match variables : Beginner in perl
by Perl_Programmer1992
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |