Perl Language: How To Use Variables in Perl Program

in perl •  6 months ago 

Learn How To Use Variable in Perl Program. Variables are pretty much common in almost every programming language. Variables are basically memory locations that allows you to store data. And they allow you to temporarily modify the location or keep the location fixed with some data. So in the video below we are going to learn how to use variables in Perl.

There are three basic data types that you notice with the perl language. So you get to use the below data types in perl.

  1. scalar
  2. array
  3. hash

So when you are working with the variables you may have to at some point extend your variables to one of those data types.

Few things you would notice is that as follows.

  1. Each scalar variable starts with $ sign.
  2. Array variable starts with @ sign.
  3. Hash variables start with the % sign.

You may also come across the list in the perl. Where list can have scalar or the hash data in it. So hopefully you find the above video of How to use Variables in Perl useful for your learning. Let me know in the comments if you have found the use of the video.

Variables are basic of perl, so make sure you get your concepts clear properly. Learn about what should be usable and what is not acceptable in writing the variable.

If you haven't checked out the first video in the series. Check how to run program in Perl

Tips for Running Perl Code

You can check the installation of the perl by typing the following code if you are on unix or linux, in case of windows you have to check the path if perl bin folder is added there.

which perl

Perl code requires you to have the code stored in the .perl file extension file. This way when you run the perl code say it's in the file named helloworld . pl

You can run the perl file on command prompt like this.

perl helloworld . pl

That's it. You can now execute the perl code on your computer.

I recommend checking out Learning Perl book. You can get a lot of answers to your questions. Plus the new edition of the book can cover some of the latest topics too.

If you are interested in modern language, try Go Language Tutorials.

I hope the information here helps you. I'd appreciate if you like the video and share it with others.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!