Memory variable
The memory of a computer is organized into a regular pattern of containers for information. These containers for information are called "words". Each one has a numeric address and each one is the same size as each of the others. For most applications, it is inconvenient to refer to portions of memory by their numeric addresses, so programming languages allow us to allocate portions of memory by name. When we store information in the memory of a computer we need to decide on how much we need for various purposes and on how it will be organized. Programming languages provide mechanism for "types" of information in memory. They also provide mechanisms to identify repetitive arrays of items of the same type and to aggregate possibly heterogeneous types under a common name.Definition: A variable is a way of referring to a memory location used in a computer program. This memory location holds values- perhaps numbers or text or more complicated types of data like a payroll record.
Operating Systems load programs into different parts of RAM so there is no way of knowing exactly which memory location will hold a particular variable before the program is run. By giving a variable a symbolic name like "employee_payroll_id" the compiler or interpreter can always work out where to store the variable in memory.
VariableYou will learn more about variable and arrays, these are the smallest components of a programming language.
What is variable?
Every computer has internal memory (read as RAM)
You need to use RAM of a computer writing a Perl program
As shown in following figure memory is series of separate memory cells i.e. RAM is divided into several locations. Each location has got its own address
Each storage location holds a small amount of information
In oder to store or retrieve information from a memory location, you must give that particular location a name. This is commonly know as memory variable
So variable is a character of group of character assigned by the Perl programmer to a single memory location and used in the program as the name of that memory location in order to access the value stored in it (or assign new value to it)
For example in expression Y=10, Y is a name of memory location (variable) where 10 is stored.
Under Perl a variable can be created at anywhere (any point) in the code. Perl variable divided into three basic categories:
Scalar
Array
Hash
In the structure of a database, the smallest component under which data is entered through data capture or data entry. All data fields in the same database have unique names, several data fields make up a data record, several data records make up a data file, and several data files make up a database.
A data field is the smallest subdivision of the stored data that can be accessed. A data field can be used to store numerical information such as price, count or a date or time, or even a data and time. A pair of data fields can be used in combination to hold a geo-spatial coordinate. Also, a data field can be used to hold a block of text. A data field takes up permanent storage within the data-store.
The data-store is composed of a number of data records which are, in turn, composed of a number of predefined data fields. Each of these data fields must be defined within the Load Definition File with a unique name.
Variables and Memory
5 distinct areas of memory
--Code space: This is where the executable instructions of the program are kept.
--registers: are part of the CPU that take care of internal housekeeping. Among other things, they contain an identifier that points to the next line of code that is to be executed, and the stack pointer.
--Global Name Space: contains objects allocated by the linker which will persist for the duration of the program.
--Stack: contains local variables, whose persistency is defined by their scope.
--Free Store, or Heap is explicitly created and destroyed by issuing new and delete commands.