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

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 :(

Replies are listed 'Best First'.
Re^5: matching POD footnote
by tobyink (Canon) on Jul 18, 2013 at 08:58 UTC

    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 ?

        Every footnote starts with N< and ends with .> may be substitute them one at a time ?

        No. Start by slurping the entire file into a scalar (not an array; probably what your teacher is trying to teach you)