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

Hi All,

I am trying to use Text::Autoformat as opposed to perls built in format stuff (based on the recommendation of Dave Rolsky).

Using the example provided in the docs for Text::Autoformat (version 1.04 by the way) I tried to setup a print form bit.

The form I setup is a bit complicated so I will refrain from posting it unless you all feel it is necessary. I am not sure it is since I could very well just be making a simple mistake here.

The problem is that when I try to run the print form bit I get this error.

/usr/local/lib/perl5/site_perl/5.6.1/Text/Autoformat.pm line 132: Can't use string ("") as a SCALAR ref while "strict refs" in use

128: my $text = ''; 129: my $rem = $_[1]; 130: my $config = $_[3]; 131: 132: $$ref =~ s/\A\s*//; 133: my $fmtnum = length $_[0];

None of the variables I am passing in to the print form are currently set (and in production some may be set and some may not be) I just want to see if the format is right by printing one without the variable data on it. Just the lines and such. Does Text::Autoformat not support doing this with empty variables? Will they all have to be set to have a blank space in them? Like, " " instead of ""? Any help with this matter would be appreciated. Thanks all.

Replies are listed 'Best First'.
Re: Using Text::Autoformat
by BUU (Prior) on Jun 10, 2002 at 22:40 UTC
    Im betting that $ref contains an empty value, so when it attempts to create a ref to that value, it fails. Are you sure your supposed to have $$ref and not $ref?

      That seems like a good question to me. But as those lines are from Autoformat.pm then I am not entirely sure what the answer should be.

      A reply falls below the community's threshold of quality. You may see it by logging in.