in reply to Re^2: matching POD footnote
in thread matching POD footnote

Can you explain what  my @file = <DATA>; does?

Can you explain what  s/$Npod/$N$1$n/s for @file; does?

At what point does $_ contain multiple lines?

Basic debugging checklist, $_ never contains more than one line

Replies are listed 'Best First'.
Re^4: matching POD footnote
by anek77713 (Acolyte) on Jul 18, 2013 at 08:45 UTC
    my @file = <DATA>; - assigns the text from the file to an array.

    s/$Npod/$N$1$n/s for @file;

    - replaces N<..(some text)..>

    with <font class="footnote">..(some text)..</font>

    and this is the problem... It does not work :(

      I think the anonymous monk was wanting you to think in more detail about what the following does:

      s/$Npod/$N$1$n/s for @file;

      You might write that in longhand as:

      foreach my $line (@file) { $line =~ s/$Npod/$N$1$n/s; }

      In other words, it's acting on one line at a time. The only pod footnote in your example input was split over multiple lines.

      package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name
        Every footnote starts with N< and ends with .>

        may be substitute them one at a time ?