<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 12 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">My preference would be to read the file line by line and apply a regex – that gives you finer control – and it’s easier to add features going forward (with
 additional regexes).<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">The performance hit (in most cases) isn’t noticeable.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">KenMc<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Bradley Andersen [mailto:bradley.d.andersen@gmail.com]
<br>
<b>Sent:</b> Wednesday, May 16, 2012 1:55 PM<br>
<b>To:</b> MCNAMARA, KEN<br>
<b>Cc:</b> Joe Kline; mark@purdue.edu; Purdue Perl Mongers<br>
<b>Subject:</b> Re: [Purdue-pm] help!<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt">so i guess my error was in thinking that would somehow skip the first line of the file being read in.  now i need a different way to do that.<br>
<br>
<br>
<o:p></o:p></p>
<div>
<p class="MsoNormal">On Wed, May 16, 2012 at 1:53 PM, MCNAMARA, KEN <<a href="mailto:km1921@att.com" target="_blank">km1921@att.com</a>> wrote:<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">The sub routine returns the ‘last evaluated expression’.</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">If you wrote (in the body of the subroutine):</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">my $value;</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">while(<FH>) { $value = $_; }</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">return $value;</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Then you get the contents of the file as intended.</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">my $next = <FH>;  -- is meaningless since FH was already at end of file in “while(<FH>)”.</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">KenMc</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> purdue-pm-bounces+km1921=<a href="mailto:att.com@pm.org" target="_blank">att.com@pm.org</a>
 [mailto:<a href="mailto:purdue-pm-bounces%2Bkm1921" target="_blank">purdue-pm-bounces+km1921</a>=<a href="mailto:att.com@pm.org" target="_blank">att.com@pm.org</a>]
<b>On Behalf Of </b>Bradley Andersen<br>
<b>Sent:</b> Wednesday, May 16, 2012 1:49 PM<br>
<b>To:</b> Joe Kline<br>
<b>Cc:</b> <a href="mailto:mark@purdue.edu" target="_blank">mark@purdue.edu</a>; Purdue Perl Mongers<br>
<b>Subject:</b> Re: [Purdue-pm] help!</span><o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;margin-bottom:12.0pt">I have just confirmed using the latter (new) method that the first <FH> does not do what I had thought (skip first line of the file read).<br>
<br>
So Joe's comment about trying to be too clever on that bit looks correct.<br>
<br>
<o:p></o:p></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">On Wed, May 16, 2012 at 1:27 PM, Bradley Andersen <<a href="mailto:bradley.d.andersen@gmail.com" target="_blank">bradley.d.andersen@gmail.com</a>> wrote:<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Yeah, in the end I don't care if it is clever or not, so long as the code works and it is readable :)<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;margin-bottom:12.0pt"><br>
<br>
<o:p></o:p></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">On Wed, May 16, 2012 at 1:25 PM, Joe Kline <<a href="mailto:gizmo@purdue.edu" target="_blank">gizmo@purdue.edu</a>> wrote:<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">-----BEGIN PGP SIGNED MESSAGE-----<br>
Hash: SHA1<o:p></o:p></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;margin-bottom:12.0pt"><br>
On 05/16/2012 01:20 PM, Bradley Andersen wrote:<br>
> ok, i just fixed it, but i'd like to still figure out why it worked<br>
> then stopped.  there must be something wrong with the earlier<br>
> logic.  for reference, here's what i did:<br>
><br>
> i replaced: 1999             #####open(FH,<br>
> "$base/helping$full.html") || die "\n\nCould not READ<br>
> $base/helping$full.html: [$!]\n\n"; 2000<br>
> #####$tpl->param("m$full" => do { local $/; while (<FH>) { my $next<br>
> = <FH>; } });<br>
><br>
> with: 2001 2002             my $contents; 2003             { 2004<br>
> local $/; 2005                 open(FH, "$base/helping$full.html")<br>
> || die "\n\nCould not READ $base/helping$full.html: [$!]\n\n"; 2006<br>
> $contents = <FH>; 2007                 close(FH); 2008<br>
> } 2009             $tpl->param("m$full" => $contents);<br>
><br>
> Can you see immediately why the first one would be no good? It<br>
> almost seems like the tpl->param is not being set as a string.<br>
> That is, clearly it reads it, but it is not assigning the result<br>
> properly as a string.  All I got were undefs in the log for the<br>
> earlier logic.  I am 199% sure this worked using the earlier logic<br>
> yesterday.<br>
><o:p></o:p></p>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Brad,<br>
<br>
I don't see much of a reason why the file slurping wasn't<br>
working...maybe that bit to strip the first line out was a bit too much?<br>
<br>
It took me a bit to figure out why that slurp line looked familiar but<br>
odd:<br>
<br>
<a href="http://www.modernperlbooks.com/mt/2009/08/a-one-line-slurp-in-perl-5.html" target="_blank">http://www.modernperlbooks.com/mt/2009/08/a-one-line-slurp-in-perl-5.html</a><br>
<br>
I guess just an example where the less clever option worked out better.<br>
<br>
joe<br>
-----BEGIN PGP SIGNATURE-----<br>
Version: GnuPG v2.0.14 (GNU/Linux)<br>
Comment: Using GnuPG with Mozilla - <a href="http://enigmail.mozdev.org/" target="_blank">
http://enigmail.mozdev.org/</a><br>
<br>
iEYEARECAAYFAk+z4xwACgkQb0mzA2gRTpkaZwCghpbMGF2dWaw0kiEXaEjWf0Uy<br>
hQsAn2YFkhpY5WPmVPe9BsMTTSC7gphi<br>
=uVn0<br>
-----END PGP SIGNATURE-----<br>
_______________________________________________<br>
Purdue-pm mailing list<br>
<a href="mailto:Purdue-pm@pm.org" target="_blank">Purdue-pm@pm.org</a><br>
<a href="http://mail.pm.org/mailman/listinfo/purdue-pm" target="_blank">http://mail.pm.org/mailman/listinfo/purdue-pm</a><o:p></o:p></p>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
</div>
</div>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>