Thanks for all of your help.

Over the weekend I was thinking about how this script was only producing a blank page. I started thinking about the end peice of code, near the errorHTML sub. Looking at it, I noticed that if there were no posts on the file, it would not go into the if(@array) loop at all thus printing nothing out on the screen!! So, I made some changes to the code and I am now asking for suggestions on improving it.
#!/usr/bin/perl -w # can't use -T because I use the rename function :( use CGI qw/param textarea textfield header submit start_form end_form/ +; #use CGI::Carp; use strict; #use diagnostics; print header; my $name = param('name'); my $said = param('talk'); my $file = 'tagbox';my $ext ='.txt'; my $full = $file.$ext; if($name && $said){ if(defined($name && $said)){ $said =~ s/`/\'/g; $name =~ s/`/\'/g; open TAG,">>$full" || errorHTML("Couldn't open the +file because $!"); print TAG $name,"`",$said,"\n"; close(TAG) || errorHTML("Shiznit"); } } my (@array, @array2,); if( -e $full){ open TAG2,"<$full" || errorHTML("Damn it!"); @array = <TAG2>; close(TAG2) || errorHTML("Fsck!"); } if(@array){ #make sure there are some posts... foreach(@array){ my ($name,$said) = split/`/; push @array2,"$name - $said"; } if($#array2 > 24){ for my $i(1..100){ my $file2 = $file.$i; my $file3 = $file2.$ext; if(-e $file3){ next; }else{ rename($full,$file3); } } } $ENV{SCRIPT_NAME} =~ s/.*\/(.*\.(pl|cgi))/$1/i; # greediness can b +e good, occasionally print start_form(-action=>"$ENV{SCRIPT_NAME}"); print qq!<textarea name="" rows=15 cols=25 style='font-size:8pt' r +eadonly>!; print @array2; print qq(</textarea>\n<Br/>); print "Name:\n",textfield(-name=>'name',-value=>$name,-maxlength=> +10,-style=>'font-size:8pt'),"<BR>\n\n"; print "Shit:&nbsp;&nbsp;&nbsp;\n","<input type=text name='talk' va +lue='' maxlength=50 style='font-size:8pt'>\n\n"; print submit(-name=>'',-value=>'Tag the thing'); print end_form; }else{ print "There are no posts. Make one yourself."; print "<BR><BR>\n\n"; print start_form(-action=>"$ENV{SCRIPT_NAME}"); print "Name:\n",textfield(-name=>'name',-value=>$name,-maxlength=> +10,-style=>'font-size:8pt'),"<BR>\n\n"; print "Shit:&nbsp;&nbsp;&nbsp;\n","<input type=text name='talk' va +lue='' maxlength=50 style='font-size:8pt'>\n\n"; print submit(-name=>'',-value=>'Tag the thing'); print end_form; } sub errorHTML{print "<H1>Error!</h1>\n<BR>\n<BR>\n@_";}
Working Test here

Almost a Perl hacker.
Dave AKA damian

I encourage you to email me

In reply to Re: Script is not producing output. by damian1301
in thread Script is not producing output. by damian1301

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.