Loading ...
Sorry, an error occurred while loading the content.

Global symbol "@blah" requires explicit package name

Expand Messages
  • mandwahlin
    Hello, This is my first attempt at perl, please forgive my ignorance. I m getting this error message- Global symbol @slyarts requires explicit package name
    Message 1 of 5 , Aug 4 10:06 PM
    • 0 Attachment
      Hello,

      This is my first attempt at perl, please forgive my ignorance. I'm
      getting this error message-

      Global symbol "@slyarts" requires explicit package name at ./do.pl
      line 16.
      syntax error at ./do.pl line 17, near "$reply "
      Global symbol "@moke" requires explicit package name at ./do.pl line
      17.
      Execution of ./do.pl aborted due to compilation errors.

      my code is as follows:

      #!/bin/perl -w
      use strict;
      use CGI;
      use CGI::Carp qw(fatalsToBrowser);

      # Variable declaration
      my ($form, $txt,$sur,$mail,$file,$mailprog,$from,$reply);


      $form = new CGI;
      $txt = $form->param('name');
      $sur = $form->param('surname');
      $mail = $form->param('email');
      $file = "data.txt";
      $mailprog = "/bin/easymail -t";
      $from = "webmaster@..."
      $reply = "reply@..."

      open (FILE, ">>data.txt");
      print FILE $txt."\t".$sur."\t".$mail."\n";
      close(FILE);

      open( EZMAIL, "|$mailprog" );
      print EZMAIL "From: from\$from\nTo: to\$mail\n";
      print EZMAIL "Subject: This is a test message\n";
      print EZMAIL "X-Priority: 1\n";
      print EZMAIL "Reply-To: $reply\n";
      print EZMAIL "Organization: Sly Arts.\n";
      print EZMAIL "\nThis is a test message.\n";
      print EZMAIL "\n.\n";
      close( EZMAIL );

      Thanks in anticipaton :)
    • Carlos Diaz
      Your answer is double quote interpolation ... it is seeing your funny caracters $... and @... as variables not declared under strict pragma. You must scape
      Message 2 of 5 , Aug 4 10:15 PM
      • 0 Attachment
        Your answer is "double quote interpolation"... it is seeing your funny
        caracters $... and @... as variables not declared under strict pragma. You
        must scape those caracters when using double quotes for literal
        interpretation.

        CD

        -----Original Message-----
        From: mandwahlin [mailto:mandwahlin@...]
        Sent: Tuesday, August 05, 2003 12:07 AM
        To: perl-beginner@yahoogroups.com
        Subject: [PBML] Global symbol "@blah" requires explicit package name


        Hello,

        This is my first attempt at perl, please forgive my ignorance. I'm
        getting this error message-

        Global symbol "@slyarts" requires explicit package name at ./do.pl
        line 16.
        syntax error at ./do.pl line 17, near "$reply "
        Global symbol "@moke" requires explicit package name at ./do.pl line
        17.
        Execution of ./do.pl aborted due to compilation errors.

        my code is as follows:

        #!/bin/perl -w
        use strict;
        use CGI;
        use CGI::Carp qw(fatalsToBrowser);

        # Variable declaration
        my ($form, $txt,$sur,$mail,$file,$mailprog,$from,$reply);


        $form = new CGI;
        $txt = $form->param('name');
        $sur = $form->param('surname');
        $mail = $form->param('email');
        $file = "data.txt";
        $mailprog = "/bin/easymail -t";
        $from = "webmaster@..."
        $reply = "reply@..."

        open (FILE, ">>data.txt");
        print FILE $txt."\t".$sur."\t".$mail."\n";
        close(FILE);

        open( EZMAIL, "|$mailprog" );
        print EZMAIL "From: from\$from\nTo: to\$mail\n";
        print EZMAIL "Subject: This is a test message\n";
        print EZMAIL "X-Priority: 1\n";
        print EZMAIL "Reply-To: $reply\n";
        print EZMAIL "Organization: Sly Arts.\n";
        print EZMAIL "\nThis is a test message.\n";
        print EZMAIL "\n.\n";
        close( EZMAIL );

        Thanks in anticipaton :)




        Unsubscribing info is here:
        http://help.yahoo.com/help/us/groups/groups-32.html

        Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
      • Damien Carbery
        ... pragma. You ... An even easier solution is to use single quotes. Then you won t have to escape the $ and @ characters. BTW, you escape special
        Message 3 of 5 , Aug 5 2:35 AM
        • 0 Attachment
          --- In perl-beginner@yahoogroups.com, "Carlos Diaz" <perl@f...> wrote:
          > Your answer is "double quote interpolation"... it is seeing your funny
          > caracters $... and @... as variables not declared under strict
          pragma. You
          > must scape those caracters when using double quotes for literal
          > interpretation.
          >
          > CD
          >
          An even easier solution is to use single quotes. Then you won't have
          to escape the '$' and '@' characters.

          BTW, you 'escape' special characters by putting a backslash, '\', in
          front of them.

          > -----Original Message-----
          > From: mandwahlin [mailto:mandwahlin@m...]
          > Sent: Tuesday, August 05, 2003 12:07 AM
          > To: perl-beginner@yahoogroups.com
          > Subject: [PBML] Global symbol "@blah" requires explicit package name
          >
          >
          > Hello,
          >
          > This is my first attempt at perl, please forgive my ignorance. I'm
          > getting this error message-
          >
          > Global symbol "@slyarts" requires explicit package name at ./do.pl
          > line 16.
          > syntax error at ./do.pl line 17, near "$reply "
          > Global symbol "@moke" requires explicit package name at ./do.pl line
          > 17.
          > Execution of ./do.pl aborted due to compilation errors.
          >
          > my code is as follows:
          >
          > #!/bin/perl -w
          > use strict;
          > use CGI;
          > use CGI::Carp qw(fatalsToBrowser);
          >
          > # Variable declaration
          > my ($form, $txt,$sur,$mail,$file,$mailprog,$from,$reply);
          >
          >
          > $form = new CGI;
          > $txt = $form->param('name');
          > $sur = $form->param('surname');
          > $mail = $form->param('email');
          > $file = "data.txt";
          > $mailprog = "/bin/easymail -t";
          > $from = "webmaster@s..."
          > $reply = "reply@m..."
          >
          > open (FILE, ">>data.txt");
          > print FILE $txt."\t".$sur."\t".$mail."\n";
          > close(FILE);
          >
          > open( EZMAIL, "|$mailprog" );
          > print EZMAIL "From: from\$from\nTo: to\$mail\n";
          > print EZMAIL "Subject: This is a test message\n";
          > print EZMAIL "X-Priority: 1\n";
          > print EZMAIL "Reply-To: $reply\n";
          > print EZMAIL "Organization: Sly Arts.\n";
          > print EZMAIL "\nThis is a test message.\n";
          > print EZMAIL "\n.\n";
          > close( EZMAIL );
          >
          > Thanks in anticipaton :)
          >
          >
          >
          >
          > Unsubscribing info is here:
          > http://help.yahoo.com/help/us/groups/groups-32.html
          >
          > Your use of Yahoo! Groups is subject to
          http://docs.yahoo.com/info/terms/
        • mandwahlin
          ... funny ... Hi Damien and Carlos Thanks for your help, I figured it was something to do with the @ characters but couldn t find an answer on the net, so
          Message 4 of 5 , Aug 5 5:13 AM
          • 0 Attachment
            --- In perl-beginner@yahoogroups.com, "Damien Carbery"
            <daymobrew@y...> wrote:
            > --- In perl-beginner@yahoogroups.com, "Carlos Diaz" <perl@f...>
            wrote:
            > > Your answer is "double quote interpolation"... it is seeing your
            funny
            > > caracters $... and @... as variables not declared under strict
            > pragma. You
            > > must scape those caracters when using double quotes for literal
            > > interpretation.
            > >
            > > CD
            > >
            > An even easier solution is to use single quotes. Then you won't have
            > to escape the '$' and '@' characters.
            >
            > BTW, you 'escape' special characters by putting a backslash, '\', in
            > front of them.
            Hi Damien and Carlos

            Thanks for your help, I figured it was something to do with the @
            characters but couldn't find an answer on the net, so cheers

            my code now reads

            #!/bin/perl -w
            use strict;
            use CGI;
            use CGI::Carp qw(fatalsToBrowser);

            # Variable declaration
            my ($form, $txt,$sur,$mail,$file,$mailprog,$from,$reply);


            $form = new CGI;
            $txt = $form->param('name');
            $sur = $form->param('surname');
            $mail = $form->param('email');
            $file = "data.txt";
            $mailprog = "/bin/easymail -t";
            $from = "webmaster\@...";
            $reply = "reply\@...";

            open (FILE, ">>data.txt");
            print FILE $txt."\t".$sur."\t".$mail."\n";
            close(FILE);

            open( EZMAIL, "|$mailprog" );
            print EZMAIL "From: $from\nTo: $mail\n";
            print EZMAIL "Subject: This is a test message\n";
            print EZMAIL "X-Priority: 1\n";
            print EZMAIL "Reply-To: $reply\n";
            print EZMAIL "Organization: Sly Arts.\n";
            print EZMAIL "\nYo Tobe and Pete, thanks 4 testing:).\n";
            print EZMAIL "\n.\n";
            close( EZMAIL );
          • mandwahlin
            ... your ... have ... in ... First script working yay! Did I say thanks? *dances around room with delight
            Message 5 of 5 , Aug 5 5:15 AM
            • 0 Attachment
              --- In perl-beginner@yahoogroups.com, "mandwahlin" <mandwahlin@m...>
              wrote:
              > --- In perl-beginner@yahoogroups.com, "Damien Carbery"
              > <daymobrew@y...> wrote:
              > > --- In perl-beginner@yahoogroups.com, "Carlos Diaz" <perl@f...>
              > wrote:
              > > > Your answer is "double quote interpolation"... it is seeing
              your
              > funny
              > > > caracters $... and @... as variables not declared under strict
              > > pragma. You
              > > > must scape those caracters when using double quotes for literal
              > > > interpretation.
              > > >
              > > > CD
              > > >
              > > An even easier solution is to use single quotes. Then you won't
              have
              > > to escape the '$' and '@' characters.
              > >
              > > BTW, you 'escape' special characters by putting a backslash, '\',
              in
              > > front of them.
              > Hi Damien and Carlos
              >
              > Thanks for your help, I figured it was something to do with the @
              > characters but couldn't find an answer on the net, so cheers
              >
              > my code now reads
              >
              > #!/bin/perl -w
              > use strict;
              > use CGI;
              > use CGI::Carp qw(fatalsToBrowser);
              >
              > # Variable declaration
              > my ($form, $txt,$sur,$mail,$file,$mailprog,$from,$reply);
              >
              >
              > $form = new CGI;
              > $txt = $form->param('name');
              > $sur = $form->param('surname');
              > $mail = $form->param('email');
              > $file = "data.txt";
              > $mailprog = "/bin/easymail -t";
              > $from = "webmaster\@...";
              > $reply = "reply\@...";
              >
              > open (FILE, ">>data.txt");
              > print FILE $txt."\t".$sur."\t".$mail."\n";
              > close(FILE);
              >
              > open( EZMAIL, "|$mailprog" );
              > print EZMAIL "From: $from\nTo: $mail\n";
              > print EZMAIL "Subject: This is a test message\n";
              > print EZMAIL "X-Priority: 1\n";
              > print EZMAIL "Reply-To: $reply\n";
              > print EZMAIL "Organization: Sly Arts.\n";
              > print EZMAIL "\nYo Tobe and Pete, thanks 4 testing:).\n";
              > print EZMAIL "\n.\n";
              > close( EZMAIL );

              First script working yay! Did I say thanks? *dances around room with
              delight
            Your message has been successfully submitted and would be delivered to recipients shortly.