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

.I am ensuring that some Perl written using an old version of Perl will work with version 5.018001.

Currently I have a problem with a message associated with a format statement

The message is “Use of comma-less variable list is deprecated at …format_quey.pl line nn”. I did not get this message with the earlier version of Perl and I would like to prevent this being given. The file seems to be written correctly

A test version of the Perl code is given below and this gives the message three times. These were
twice for line 38 which starts $xml_machine $xm
once for line 45 which starts $xml_pile $xml_tn

I would like to know why this message is given and how I can prevent it being written

use Tk; use strict "vars"; sub write_report() { my ($xml_drawing, $xml_machine, $xml_material, $xml_date, $xml_nest_ty +pe, $xml_mcy_text, $xml_pile, $xml_tn, $date_use); my ($summary_file, $res_open_summary_file); $summary_file = ">c:\\temp\\summary_file.txt"; $xml_drawing = "Pilot XX1"; $xml_machine = "Bruning"; $xml_material = "steel"; $xml_date = "12/01/2015"; $xml_nest_type = "Open"; $xml_mcy_text = "Test text"; $xml_pile = "Py 1234"; $xml_tn = "TS12"; $date_use = "16 Jan 2015"; $res_open_summary_file = open(SUMMOP, $summary_file); print "open file result <$res_open_summary_file>\n"; format_name SUMMOP "HEAD1B"; write SUMMOP; close(SUMMOP); format HEAD1B = DATE: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $date_use GAME NAME @<<<<<<<<<<<<<<<< $xml_drawing MACHINE MATERIAL + DATE REQ --------- ---------- + ----------- @||||||||||||||||||||||||||||||||| @||||||||||||||||||||||||||| + @||||||||| $xml_machine $xml_material $xml_date @||||||||||||||| $xml_nest_type (FULL PLATE) (STORED IN PILE @||||||||||||) (TEST NO. @|| +||||||) $xml_pile $xml_tn @||||||||||||||||||||||||||||| $xml_mcy_text . } write_report(); print "\nafter call to write_report - perl version $]\n";

Replies are listed 'Best First'.
Re: Format definition query
by nlwhittle (Beadle) on Jan 12, 2015 at 15:22 UTC

    You need to put a comma after each variable in the lines where the errors occur. The format documentation shows an example.

    --Nick

      Many thanks - adding commas did the trick. I suspected it may be simple.

      It is interesting that the error message does give a clue to what has to be done but it is much clearer when you know the answer!

Re: Format definition query
by GotToBTru (Prior) on Jan 12, 2015 at 15:18 UTC

    I suggest you read the warning message. It tells you what to do.

    1 Peter 4:10
      If you need more verbose explanation of warning messages then they can be piped through splain command like this:
      $ perl -wc myscript.pl 2>&1 | splain