Hi,

I'm running into some very strange behaviour with Apache::print.  print() 
is supposed to dereference any arguments that are scalar references.

However it doesn't work if you apply a non-greedy substitution operator on
the scalar.

The following code outputs in my browser:

CODE:
sub handler {
  my $r = shift;
  my $text = "hello world";
  $text =~ s/hello/hi/;
  $r->print(\$text);
}

OUTPUT:
SCALAR(0x89bd084)

What's really weird is that it works if i change the
substitution operator to greedy:

CODE:
sub handler {
  my $r = shift;
  my $text = "hello world";
  $text =~ s/hello/hi/g;    # <--- changed to /g
  $r->print(\$text);
}

OUTPUT:
hi world

Any ideas?  I'm running Perl 5.6.0/mod_perl 1.24/Apache 1.3.12 on Linux
2.2.12 (red hat 6.1) on i686.

Thanks,
T.J. Mather

Reply via email to