title: Number appearing in Perl-generated JavaScript code instead of "$("
body: <p>On a site I'm working on there are random numbers appearing in a very simple bit of jQuery. </p>
  
  <p>Instead of what's meant to appear, these numbers — <code>48</code>, etc. — appear at the beginning. Like this:</p>
  
  
  
  <pre><code>&lt;script type="text/javascript"&gt;
      48 48document).ready(function () {
      48 48".closed").click(function () {         
          48 48this).find("div.but").toggleClass('plus').toggleClass('minus');           
               48 48this).toggleClass('closed').toggleClass('open');    
          });    
      });        
  &lt;/script&gt;
  </code></pre>
  
  <p>I can't even begin to imagine why it would spit this out when I hard-coded it into the site and there's no external file or anything.</p>
  
  <p>OK, so since it's Perl I need to escape <code>$(</code>, but how? I took a look at the Perl documentation and I just felt like I'd been punched.</p>
  
  <p>Do I just use single quotes instead of double quotes?</p>
  
  
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $(document).ready(function () {
        $('.closed').click(function () {          
          $(this).find('div.but').toggleClass('plus').toggleClass('minus');
          $(this).toggleClass('closed').toggleClass('open');    
        });
    });
  &lt;/script&gt;
  </code></pre>
  
  <p>Here's the full Perl script. It's the header of a site.</p>
  
  
  
  <pre><code>###########################
  ## META DATA AND HEADERS ##
  ###########################
  
  $be_strict = 0;    # 1 = 404 on page not found
  if ((!$title{$loadpage} || !$h1{$loadpage} || !$description{$loadpage} || !$keywords{$loadpage} || !$breadcrumb{$loadpage}) &amp;&amp; $be_strict) {
    print "Status: 302 Found\r\n" .
        "Location: http://www.realots.co/404/\r\n" .
        "\r\n";
    exit(0);
  } 
  
  if ($action) {
  
    #############################
    ## Highscore page SEO Hack ##
    #############################
  
    if ($action eq "fish") {
      $breadcrumb{'highscores'}     = "&lt;a href='/'&gt;RealOTS&lt;/a&gt; &amp;raquo; &lt;a href='/highscores/'&gt;Highscores&lt;/a&gt; &amp;raquo; &lt;b&gt;Fishing Skill&lt;/b&gt;";
      $h1{'highscores'}             = "RealOTS Fishing Highscores";
      $title{'highscores'}          = "RealOTS Top Fishing Skill";
      $description{'highscores'}    = "Fishing Skill Highscore list of our RealOTS. Check out these amazing fishermen!";
      $keywords{'highscores'}       = "realots,otserv,tibia,highscore,hiscores,fishing,top fishing";
    }
    elsif ($action eq "ml") {
      $breadcrumb{'highscores'}     = "&lt;a href='/'&gt;RealOTS&lt;/a&gt; &amp;raquo; &lt;a href='/highscores/'&gt;Highscores&lt;/a&gt; &amp;raquo; &lt;b&gt;Magic Level&lt;/b&gt;";
      $h1{'highscores'}             = "RealOTS Magic Highscores";
      $title{'highscores'}          = "RealOTS Top Magic Level";
      $description{'highscores'}    = "Magic Level Highscore list of our RealOTS. Check out these fearsome mages!";
      $keywords{'highscores'}       = "realots,otserv,tibia,highscore,hiscores,magic,top magic";
    }
    elsif ($action eq "sword") {
      $breadcrumb{'highscores'}     = "&lt;a href='/'&gt;RealOTS&lt;/a&gt; &amp;raquo; &lt;a href='/highscores/'&gt;Highscores&lt;/a&gt; &amp;raquo; &lt;b&gt;Sword Fighting&lt;/b&gt;";
      $h1{'highscores'}             = "RealOTS Sword Fighting Highscores";
      $title{'highscores'}          = "RealOTS Top Sword Fighters";
      $description{'highscores'}    = "Sword Fighting Highscore list of our RealOTS. Fear the mighty sword wielder!";
      $keywords{'highscores'}       = "realots,otserv,tibia,highscore,hiscores,sword,top sword";
    }
    elsif ($action eq "axe") {
      $breadcrumb{'highscores'}     = "&lt;a href='/'&gt;RealOTS&lt;/a&gt; &amp;raquo; &lt;a href='/highscores/'&gt;Highscores&lt;/a&gt; &amp;raquo; &lt;b&gt;Axe Fighting&lt;/b&gt;";
      $h1{'highscores'}             = "RealOTS Axe Fighting Highscores";
      $title{'highscores'}          = "RealOTS Top Axe Fighters";
      $description{'highscores'}    = "Axe Fighting Highscore list of our RealOTS. Behold these savage beasts with their amazing axe skills!";
      $keywords{'highscores'}       = "realots,otserv,tibia,highscore,hiscores,axe,top axe,axe fighting";
    }
    elsif ($action eq "club") {
      $breadcrumb{'highscores'}     = "&lt;a href='/'&gt;RealOTS&lt;/a&gt; &amp;raquo; &lt;a href='/highscores/'&gt;Highscores&lt;/a&gt; &amp;raquo; &lt;b&gt;Club Fighting&lt;/b&gt;";
      $h1{'highscores'}             = "RealOTS Club Fighting Highscores";
      $title{'highscores'}          = "RealOTS Top Club Fighters";
      $description{'highscores'}    = "Club Fighting Highscore list of our RealOTS. Caveman-like agility all around!";
      $keywords{'highscores'}       = "realots,otserv,tibia,highscore,hiscores,club,top club,club fighting";
    }
    elsif ($action eq "dist") {
      $breadcrumb{'highscores'}     = "&lt;a href='/'&gt;RealOTS&lt;/a&gt; &amp;raquo; &lt;a href='/highscores/'&gt;Highscores&lt;/a&gt; &amp;raquo; &lt;b&gt;Distance Fighting&lt;/b&gt;";
      $h1{'highscores'}             = "RealOTS Distance Fighting Highscores";
      $title{'highscores'}          = "RealOTS Top Distance Fighters";
      $description{'highscores'}    = "Distance Fighting Highscore list of our RealOTS. Death from afar, raining from the sky!";
      $keywords{'highscores'}       = "realots,otserv,tibia,highscore,hiscores,distance,top distance,distance fighting";
    }
    elsif ($action eq "shield") {
      $breadcrumb{'highscores'}     = "&lt;a href='/'&gt;RealOTS&lt;/a&gt; &amp;raquo; &lt;a href='/highscores/'&gt;Highscores&lt;/a&gt; &amp;raquo; &lt;b&gt;Shielding&lt;/b&gt;";
      $h1{'highscores'}             = "RealOTS Shielding Highscores";
      $title{'highscores'}          = "RealOTS Top Shielding";
      $description{'highscores'}    = "Shielding Highscore list of our RealOTS. These tanks are able to withstand tremendeous blows!";
      $keywords{'highscores'}       = "realots,otserv,tibia,highscore,hiscores,shielding,top shielding";
    }
    elsif ($action eq "fist") {
      $breadcrumb{'highscores'}     = "&lt;a href='/'&gt;RealOTS&lt;/a&gt; &amp;raquo; &lt;a href='/highscores/'&gt;Highscores&lt;/a&gt; &amp;raquo; &lt;b&gt;Fist Fighting&lt;/b&gt;";
      $h1{'highscores'}             = "RealOTS Fist Fighting Highscores";
      $title{'highscores'}          = "RealOTS Top Fist Fighters";
      $description{'highscores'}    = "Fist Fighting Highscore list of our RealOTS. They had special training by sensai Chuck Norris!";
      $keywords{'highscores'}       = "realots,otserv,tibia,highscore,hiscores,fist,top fist,fist fighting";
    }
  }
  
  #&amp;print_header();
  $web_content .= qq{
  &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;
  
      &lt;title&gt;$title{$loadpage}&lt;/title&gt;
      &lt;meta name="google-site-verification" content="Z97W94Kp7MlIOgiaMAYcFA4Lp4i5hckXdncRarXkBxk" /&gt;
      &lt;meta name="google-site-verification" content="I5HTpL8jLRcdrWk3jD83qIFDBkS4G_rmWHlxEq94jLU" /&gt;
      &lt;style type="text/css"&gt;
        table.outlined {
          border-width: 1px;
          order-style: solid;
          border-color: #9999CC;
          border-collapse: separate;
        }
        a.suggestions:visited{color:#0000FF;text-decoration:none;}
        a.suggestions:link{color:#0000FF;text-decoration:none;}
        a.suggestions:hover{color:#305997;text-decoration:none;}
  
  .trans {
          filter:alpha(opacity=50);
          -moz-opacity:0.5;
          -khtml-opacity: 0.5;
          opacity: 0.5;
  }
  
      &lt;/style&gt;
  &lt;!--[if IE 6]&gt;
  &lt;![endif]--&gt;
  &lt;!--[if IE 6]&gt;
  &lt;style type="text/css"&gt;
  html { overflow-y: hidden; }
  body { overflow-y: auto; }
  img#bg { position:absolute; z-index:-1; }
  #content { position:static; }
  &lt;/style&gt;
  &lt;![endif]--&gt;
  
  };
  
  if ($no_index{$loadpage}) {
    $web_content .= qq{    &lt;meta name="Robots" content="NOINDEX,NOFOLLOW,NOARCHIVE,NOSNIPPET" /&gt;};
  } else {
    $web_content .= qq{    &lt;meta name="Robots" content="index,follow" /&gt;};
  }
  
  $web_content .= qq{
      &lt;meta name="keywords" content="$keywords{$loadpage}"&gt;
      &lt;meta name="description" content="$description{$loadpage}"&gt;
      &lt;meta name="author" content="RealOTS" /&gt;
      &lt;meta name="Expires" content="never" /&gt;
      &lt;link rel="stylesheet" type="text/css" href="/images/style.css" /&gt;
      &lt;script type="text/javascript" src="http://www.mollie.nl/partners/js/96481.js"&gt;&lt;/script&gt;
  
      &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"&gt;&lt;/script&gt;
  
  
     &lt;script type="text/javascript"&gt;
      $(document).ready(function () {
      $(".closed").click(function () {
  
  
          $(this).find("div.but").toggleClass('plus').toggleClass('minus');
  
           $(this).toggleClass('closed').toggleClass('open');
  
      });
  
  });
  
      &lt;/script&gt;
  
  
  
  
    &lt;/head&gt;
  };
  </code></pre>