in reply to Re^2: perl if statement
in thread perl if statement

Sure, Perl provides lots of ways of providing inline data that are better than the string of print statements used by the OP. I use DATA a lot for one off scripts that filter data I've copied and pasted from somewhere for example (Clipboard saves the need for paste and DATA though). If I need a fragment of HTML inlined then a HEREDOC is a really good choice because it makes the HTML clear and puts it right where it's used.

However, the big win with using a template system (there are may btw - HTML::Template is a really good starting point) is being able to spin off the HTML into something that is very close to a static page file that a page designer can work on without having to have any understanding of the business code that uses it. Encouraging this usage pattern is why I went to the trouble of creating a test file in the example.

The problem with the DATA section is that it doesn't scale. There is only one of them. Inline data seems rather like peanuts, it's hard to stop at one!

Premature optimization is the root of all job security