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

RE: [PBML] string concantenation

Expand Messages
  • prakash
    what was teh value u assigned to both of the variable and what are u getting perl -e $cpuscore=10;$userscore=20;print computer score: $cpuscore n User Score:
    Message 1 of 4 , Feb 3, 2003
      what was teh value u assigned to both of the variable and what are u getting

      perl -e '$cpuscore=10;$userscore=20;print "computer score: $cpuscore\n User
      Score: $userscore\n";'
      computer score: 10
      User Score: 20

      thisi s what i got...

      > -----Original Message-----
      > From: grappling_machine <faison09@...>
      > [mailto:faison09@...]
      > Sent: Monday, February 03, 2003 12:27 PM
      > To: perl-beginner@yahoogroups.com
      > Subject: [PBML] string concantenation
      >
      >
      > I am trying to get my variables $cpuscore and $userscore to print but
      > it keeps printing them literally as strings and not variables.
      > Any help would be appreciated.
      >
      > thanks
      > Shawn
      >
      >
      > print "computer score: $cpuscore\n User Score: $userscore\n";
      >
      >
      > 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/
      >
      >
      > ______________________________________________________
      > This email was pre-scanned by Spam Guardian
      > A Service Provided by www.foothill.net and FNFmail.com
      >
      >
    • grappling_machine <faison09@hotmail.com>
      Hey , i am using these variables to keep score in a game . the two variables $userchoice and $cpuchoice keep score and then are supposed to display the number
      Message 2 of 4 , Feb 3, 2003
        Hey , i am using these variables to keep score in a game .

        the two variables $userchoice and $cpuchoice keep score and then are
        supposed to display the number in the end. thing is i am still
        confused as to how we are supposed to put together the variables and
        the strings in this instance.

        print "computer score:" $cpuscore\n" "User Score: $userscore\n";
        --------------------------------------------------------------------

        #this is the context of how i am using it

        if ($userchoice eq "scissors"){

        if ($target == 2){
        print ("Computer picked SCISSORS it's a draw ");
        }
        elsif ($target == 0){
        print ("Computer picked ROCK you lose ");$cpuscore++;
        }
        elsif ($target == 1){
        print("Computer picked PAPER you win ");$userscore++;
        }#end elsif
        }#end if

        print "computer score:" $cpuscore\n" "User Score: $userscore\n";
        sleep(1)
        }#end sub

        while ($cpuscore<5 and $userscore<5){ &rpscissors();
        }
        __end__











        --- In perl-beginner@yahoogroups.com, "prakash" <prakash@f...> wrote:
        >
        > what was teh value u assigned to both of the variable and what are
        u getting
        >
        > perl -e '$cpuscore=10;$userscore=20;print "computer score:
        $cpuscore\n User
        > Score: $userscore\n";'
        > computer score: 10
        > User Score: 20
        >
        > thisi s what i got...
        >







        > > -----Original Message-----
        > > From: grappling_machine <faison09@h...>
        > > [mailto:faison09@h...]
        > > Sent: Monday, February 03, 2003 12:27 PM
        > > To: perl-beginner@yahoogroups.com
        > > Subject: [PBML] string concantenation
        > >
        > >
        > > I am trying to get my variables $cpuscore and $userscore to print
        but
        > > it keeps printing them literally as strings and not variables.
        > > Any help would be appreciated.
        > >
        > > thanks
        > > Shawn
        > >
        > >
        > > print "computer score: $cpuscore\n User Score: $userscore\n";
        > >
        > >
        > > 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/
        > >
        > >
        > > ______________________________________________________
        > > This email was pre-scanned by Spam Guardian
        > > A Service Provided by www.foothill.net and FNFmail.com
        > >
        > >
      • Carl Flippin
        This line is your problem. Your quotes are off. You want: print computer score: $cpuscore nUser Score: $userscore n ;
        Message 3 of 4 , Feb 3, 2003
          This line is your problem. Your quotes are off. You want:

          print "computer score: $cpuscore\nUser Score: $userscore\n";

          On Mon, Feb 03, 2003 at 10:01:32PM -0000, grappling_machine <faison09@...> wrote:
          >
          > print "computer score:" $cpuscore\n" "User Score: $userscore\n";
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.