in reply to Re: raffle_tickets_generator
in thread raffle_tickets_generator

It is the first time I hear about the DATA section, thanks for pointing this feature out! also that way to write loops is great, I'm going to correct that at once.

Replies are listed 'Best First'.
Re^3: raffle_tickets_generator
by GotToBTru (Prior) on Dec 04, 2015 at 14:01 UTC

    Good reference that talks about paragraph mode.

    use strict; use warnings; my ($first,$second,$third); { local $/ = ''; ($first, $second, $third) = <DATA>; } printf "First: %s", $first; printf "Second: %s", $second; printf "Third: %s", $third; __DATA__ this will go into the variable called first second here tail end charlie
    Dum Spiro Spero

      Just to be sure I get it, when you localise $/ as '' perl will see an empty line as the record separator? even if said empty line is actually just one '\n' character.

      I understand that making $/ equal '\n' you would have ended up with

      $first = "this will"; $second="go into the variable"; $third = "called first";