Search code examples
perlperl-tidy

Formatting a qw list with perltidy


Using perltidy, it will align the elements of a list assigned to an array (using quotes and commas) as follows:

my @months = (
               'January',   'February', 'March',     
               'April',     'May',      'June',
               'July',      'August',   'September', 
               'October',   'November', 'December',
             );

However, if I use perltidy on the same array assignment using qw (no qoutes nor commas), I get the following:

my @months = qw(
    January February March
    April May June
    July August September
    October November December
);

What I would like the result to look like is:

my @months = qw(
                 January    February    March
                 April      May         June
                 July       August      September
                 October    November    December
               );

I am aware that I have to set options to do this in my .perltidyrc. The problem is that I can't figure out which options will do this (if it is doable at all).


Solution

  • perltidy will not format a qw list, according to LIMITATIONS:

    What perltidy does not parse and format

    Perltidy indents but does not reformat comments and qw quotes.