Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I have the following string printed via DataDumper
$VAR1 = 'Printer1 Printer Printer 1 Printer2 Printer Printer 2 Store Printer Store printer ';
How can I split this string to get only the printer name (e.g. first word, skip the next two, next word, skip the next two) into an array? Thanks

Replies are listed 'Best First'.
Re: Split string into array
by Tux (Canon) on Dec 14, 2011 at 14:54 UTC
    my @printers = ($VAR1 =~ m{^ (\S+) }gmx);

    Enjoy, Have FUN! H.Merijn
      thanks, works perfectly.
Re: Split string into array
by moritz (Cardinal) on Dec 14, 2011 at 14:53 UTC