Expanding a string


The problem:
We have a string like this:


my $str = 'perl-{file-{which,basedir,copy-recursive},pathtools,path-class}';

... and we need to expand it into:
(
  'perl-file-which',
  'perl-file-basedir',
  'perl-file-copy-recursive',
  'perl-pathtools',
  'perl-path-class',
)

Solutions:

One-line solution: split q{ }, qx(echo $string);