2 Replies - 382 Views - Last Post: 19 July 2016 - 05:57 AM

#1 tonyal  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 85
  • Joined: 23-September 14

$_variable questions

Posted 18 July 2016 - 04:15 PM

Hi, I was hoping someone could clear up some confusion for me.
What is the $_variable? My book has just has an example of the code:

$_ = "Donald Duck\n";
chomp;
print;



I get that chomp removed the new line. I'm guessing that using $_ is why you don't need to specify it when you type print but I'm not sure. Also can you name something like $_yada and it works the same or do you have to leave it just like $_. In the paragraph in my book it says it's like a shadow (sometimes you see it sometimes you don't), so is it always there?

Is there something like this other languages/scripts that are similar to this that maybe I can connect the dots to? I'm a little familiar with Java, Python, VB, and currently learning PHP. I thank you in advance!

Is This A Good Question/Topic? 0
  • +

Replies To: $_variable questions

#2 astonecipher  Icon User is offline

  • Too busy for this
  • member icon

Reputation: 2329
  • View blog
  • Posts: 9,356
  • Joined: 03-December 12

Re: $_variable questions

Posted 18 July 2016 - 06:06 PM

Default variable This explains it better than I can.
Was This Post Helpful? 1
  • +
  • -

#3 tonyal  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 85
  • Joined: 23-September 14

Re: $_variable questions

Posted 19 July 2016 - 05:57 AM

View Postastonecipher, on 18 July 2016 - 06:06 PM, said:

Default variable This explains it better than I can.

Thanks!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1