Difference between revisions of "PERL/C2/Data-Structures/English-timed"

From Script | Spoken-Tutorial
Jump to: navigation, search
 
(11 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
{| border=1
 
{| border=1
!  <center>'''Visual Cue'''</center>
+
|'''Time'''
!  <center>'''Narration'''</center>
+
|'''Narration'''
 
   
 
   
 
|-
 
|-
| 00.00
+
| 00:00
|Welcome to the spoken tutorial on '''Data Structures''' in '''Perl'''
+
|Welcome to the spoken tutorial on '''Data Structures''' in '''Perl'''.
  
 
|-
 
|-
| 00.05
+
| 00:05
| In this tutorial, we will learn about '''Data Structures''' available in '''Perl'''
+
| In this tutorial, we will learn about '''Data Structures''' available in '''Perl'''.
  
 
|-
 
|-
|00.11
+
|00:11
|Here I am using ''' Ubuntu Linux12.04 ''' operating system and '''Perl 5.14.2'''
+
|Here, I am using ''' Ubuntu Linux 12.04 ''' operating system and '''Perl 5.14.2'''.
 
   
 
   
 
|-
 
|-
|00.18
+
|00:18
 
| I will also be using the '''gedit''' Text Editor.
 
| I will also be using the '''gedit''' Text Editor.
+
 
+
 
|-
 
|-
|00.22
+
|00:22
 
|You can use any text editor of your choice.  
 
|You can use any text editor of your choice.  
 
   
 
   
 
|-
 
|-
| 00.25
+
| 00:25
| You should have basic knowledge of '''Variables''' in  '''Perl'''
+
| You should have basic knowledge of variables in  '''Perl'''.
  
 
|-
 
|-
| 00.29
+
| 00:29
|Knowledge of ''' comments, loops''' and '''conditional statements''' will be an added advantage.  
+
|Knowledge of '''comments, loops''' and '''conditional statements''' will be an added advantage.  
  
 
|-
 
|-
| 00.36
+
| 00:36
| Please go through the relevant spoken tutorials on the '''spoken tutorial''' website.  
+
| Please go through the relevant spoken tutorials on the '''Spoken Tutorial''' website.  
 
+
  
 
|-
 
|-
|00.41
+
|00:41
|'''Perl''' has 3 types of ''' data structure - '''
+
|'''Perl''' has 3 types of '''data structures:'''
 
   
 
   
 
|-
 
|-
|00.44
+
|00:44
|'''Scalar'''
+
|'''Scalar''', '''Array'''
 
   
 
   
 
|-
 
|-
| 00.45
+
|00:46
| '''Array'''
+
| '''Hash''', also called as '''Associative Array'''.
+
|-
+
|00.46
+
|'''Hash''' , also, called as ''' Associative Array '''
+
  
 
|-
 
|-
|00.50
+
|00:50
|'''Scalar:'''  This type of '''data structure''' holds a value of any '''data type.'''
+
|'''Scalar:'''  This type of '''data structure''' holds a value of any data type.  
 
   
 
   
 
|-
 
|-
|00.56
+
|00:56
|The '''data type''' can be '''string, number, double''' etc.  
+
|The data type can be '''string, number, double''' etc.  
  
 
|-
 
|-
|01.01
+
|01:01
 
|It can also hold the reference to an '''array''' or reference to a '''hash.'''  
 
|It can also hold the reference to an '''array''' or reference to a '''hash.'''  
  
 
|-
 
|-
|01.06
+
|01:06
|'''Note:''' Reference in '''Perl''' will be covered in subsequent tutorial.  
+
|Note: '''Reference''' in '''Perl''' will be covered in subsequent tutorial.  
 
+
  
 
|-
 
|-
| 01.11
+
| 01:11
| '''Scalar''' type of  data structure is as simple as declaring the variable.  
+
|'''Scalar''' type of  data structure is as simple as declaring the variable.  
  
 
|-
 
|-
|01.16
+
|01:16
|'''$count = 12''' semicolon
+
|$count = 12 semicolon.
  
 
|-
 
|-
|01.20
+
|01:20
|''' $string''' = in single quote ''' 'I am scalar of type string' ''' semicolon.  
+
|$string = in single quote 'I am scalar of type string' semicolon.  
 
   
 
   
 
|-
 
|-
|01.26
+
|01:26
|We can perform the following operations on ''' scalar '''
+
|We can perform the following operations on scalar.
 
   
 
   
 
|-
 
|-
|01.30
+
|01:30
|Assign a value to it  
+
|Assign a value to it.
 
   
 
   
 
|-
 
|-
|01.32
+
|01:32
|Assign one '''scalar''' to another  
+
|Assign one scalar to another.
 
+
 
   
 
   
 
|-
 
|-
|01.35
+
|01:35
| '''Arithmetic operations''' on '''number''' type of scalars like add, subtract etc  
+
|Arithmetic operations on '''number''' type of scalars like add, subtract etc.
 
   
 
   
 
|-
 
|-
| 01.41
+
| 01:41
|string operations on string scalar like '''concatenation, substr''' etc  
+
| String operations on string scalar like '''concatenation, substr''' etc.
  
 
|-
 
|-
|01.48
+
|01:48
|Now let us look at an example of '''scalar data structure.'''
+
|Now, let us look at an example of scalar data structure.  
 
   
 
   
 
|-
 
|-
|01.52
+
|01:52
| Switch to terminal and type '''gedit scalars dot pl''' space '''&''' and press '''Enter.'''  
+
| Switch to terminal and type: '''gedit scalars dot pl''' space & (ampersand) and press '''Enter.'''  
  
 
|-
 
|-
| 02.01
+
| 02:01
| This will open the '''scalars dot pl file in gedit. '''
+
| This will open the 'scalars dot pl' file in '''gedit'''.
 
   
 
   
 
|-
 
|-
|02.05
+
|02:05
 
|Type the following code as displayed on the screen.  
 
|Type the following code as displayed on the screen.  
 
 
   
 
   
 
|-
 
|-
|02.09  
+
|02:09  
 
|This is the '''declaration''' and '''assignment''' to the '''scalar'''.
 
|This is the '''declaration''' and '''assignment''' to the '''scalar'''.
 
   
 
   
 
|-
 
|-
|02.13
+
|02:13
|These are few '''arithmetic operations''' that can be performed on '''number''' type of scalar  
+
|These are few arithmetic operations that can be performed on '''number''' type of scalar.
 
   
 
   
 
|-
 
|-
|02.19
+
|02:19
|These are '''string operations''' that can be performed on '''string''' type of '''scalar'''.  
+
|These are the '''string operations''' that can be performed on '''string''' type of scalar.  
 
   
 
   
 
|-
 
|-
|02.25
+
|02:25
 
| '''substr''' is the '''PERL function''' which provides part of the '''string''' as output.  
 
| '''substr''' is the '''PERL function''' which provides part of the '''string''' as output.  
 
   
 
   
 
|-
 
|-
|02.30
+
|02:30
| Here '''index 0''' specifies start of a '''string''', i.e. from where we want to start extraction of the '''string. '''
+
| Here, '''index 0''' (zero) specifies start of a '''string''', i.e. from where we want to start extraction of the '''string.'''
  
 
 
|-
 
|-
|02.39
+
|02:39
|And 11 specify the '''offset''' upto where we want the '''string''' to be in the output.  
+
|And, 11 specifies the '''offset''' upto where we want the '''string''' to be in the output.  
 
   
 
   
 
|-
 
|-
|02.46
+
|02:46
|Press '''ctrl + s''' to save the file.  
+
|Press '''Ctrl + s''' to '''save''' the file.  
 
   
 
   
 
|-
 
|-
| 02.50  
+
| 02:50  
| Then switch to the terminal and execute the '''Perl script''' as  
+
| Then switch to the terminal and execute the '''Perl script''' as:
  
 
|-
 
|-
|02.55
+
|02:55
|''' perl scalars dot pl''' and press '''Enter'''  
+
|''' perl scalars dot pl''' and press '''Enter'''.
  
 
 
|-
 
|-
|03.00
+
|03:00
|  The output shown on terminal is as highlighted
+
|  The output shown on terminal is as highlighted.
  
 
|-
 
|-
|03.05
+
|03:05
|Now, let us look at '''array data structure''' in '''PERL.'''   
+
|Now, let us look at an '''array''' data structure in '''PERL'''.  
 
   
 
   
 
|-
 
|-
|03.09
+
|03:09
 
|'''Array:'''  It is a list of  elements.
 
|'''Array:'''  It is a list of  elements.
 
   
 
   
 
 
|-
 
|-
|03.12
+
|03:12
 
|Elements can be '''string, number''' etc.  
 
|Elements can be '''string, number''' etc.  
 
   
 
   
 
|-
 
|-
| 03.16
+
|03:16
| It has an '''index,''' which is used for performing various operations on the '''array'''.  
+
| It has an '''index''' which is used for performing various operations on the '''array'''.  
 
   
 
   
 
|-
 
|-
|   03.22
+
| 03:22
 
| '''Index''' starts with zero.  
 
| '''Index''' starts with zero.  
 
   
 
   
 
 
|-
 
|-
| 03.25
+
| 03:25
| Unlike other programming languages, there is no need to declare an array or its length before using it in Perl.  
+
| Unlike other programming languages, there is no need to declare an array or its length before using it in '''Perl'''.  
+
 
   
 
   
 
|-
 
|-
|03.33
+
|03:33
|'''Perl array''', stretches or shrinks as per the elements added or removed from it  
+
|'''Perl array''' stretches or shrinks as per the elements added or removed from it.
 
   
 
   
 
|-
 
|-
| 03.39
+
| 03:39
|  The syntax to write an array is;
+
|  The syntax to write an array is:
 
   
 
   
 
|-
 
|-
| 03.41
+
| 03:41
|''' at the rate variableName space equal to ''' space open bracket list of elements separated with comma close bracket semicolon  
+
|'''at the rate (@) variableName space equal to ''' space open bracket list of elements separated with comma close bracket semicolon.
  
 
 
|-
 
|-
|03.54
+
|03:54
|Now let us look at an example of '''array data structure.'''
+
|Now, let us look at an example of '''array''' data structure.  
 
   
 
   
 
|-
 
|-
|03.57
+
|03:57
|Switch to '''terminal''' and type '''gedit perlArray dot pl''' space '''&''' and press '''Enter'''.  
+
|Switch to terminal and type: '''gedit perlArray dot pl''' space '''&''' and press '''Enter'''.  
 
   
 
   
 
|-
 
|-
|  04.08
+
|  04:08
 
|  This will open the '''perlArray dot pl''' file in '''gedit'''.   
 
|  This will open the '''perlArray dot pl''' file in '''gedit'''.   
 
   
 
   
 
|-
 
|-
|04.12
+
|04:12
 
|Type the following code as displayed on the screen.  
 
|Type the following code as displayed on the screen.  
 
 
   
 
   
 
|-
 
|-
|  04.18
+
|  04:18
 
| This is the '''number array''' which has elements of '''number''' type.  
 
| This is the '''number array''' which has elements of '''number''' type.  
 
   
 
   
 
|-
 
|-
|  04.23
+
|  04:23
 
|  This is the '''string array''' which has elements of '''string''' type.  
 
|  This is the '''string array''' which has elements of '''string''' type.  
 
   
 
   
 
|-
 
|-
|  04.29
+
|  04:29
 
| This '''array''' has elements of both '''number''' and '''string''' type.  
 
| This '''array''' has elements of both '''number''' and '''string''' type.  
 
   
 
   
 
|-
 
|-
| 04.34
+
| 04:34
| This example shows the various types of '''arrays''' in '''Perl. '''  
+
| This example shows the various types of '''arrays''' in '''Perl.'''  
  
 
|-
 
|-
| 04.39
+
| 04:39
 
| This is how we can print the '''array''' in '''Perl'''.  
 
| This is how we can print the '''array''' in '''Perl'''.  
 
  
 
|-
 
|-
|04.43
+
|04:43
 
|Press '''Ctrl + S''' to save the file.  
 
|Press '''Ctrl + S''' to save the file.  
+
 
+
 
|-
 
|-
|04.47
+
|04:47
|Then switch to  terminal and execute the '''Perl script''' as  
+
|Then switch to  terminal and execute the '''Perl script''' as:
  
 
 
|-
 
|-
|04.52
+
|04:52
 
|'''perl perlArray dot pl''' and press '''Enter.'''  
 
|'''perl perlArray dot pl''' and press '''Enter.'''  
 
 
   
 
   
 
|-
 
|-
|04.59
+
|04:59
|The following output is displayed on the terminal
+
|The following output is displayed on the terminal.
  
 
|-
 
|-
|05.04
+
|05:04
|Now, let us look at '''Hash data structure''' in '''Perl'''.  
+
|Now, let us look at '''Hash''' data structure in '''Perl'''.  
 
   
 
   
 
|-
 
|-
| 05.08
+
| 05:08
| '''Hash''' is alternatively called as '''Associative array'''
+
| '''Hash''' is alternatively called as '''Associative array'''.
  
 
|-
 
|-
| 05.12
+
| 05:12
| It is a '''Key Value pair data structure.'''
+
| It is a '''Key - Value''' pair data structure.  
 
   
 
   
 
|-
 
|-
|05.15
+
|05:15
 
|'''Key''' in '''hash''' is unique.  
 
|'''Key''' in '''hash''' is unique.  
  
 
|-
 
|-
|05.18
+
|05:18
 
|If the same '''key''' is added again, then the '''value''' of that '''key''' will be overridden by the latest '''value''' assigned to the '''key'''.  
 
|If the same '''key''' is added again, then the '''value''' of that '''key''' will be overridden by the latest '''value''' assigned to the '''key'''.  
 
   
 
   
 
|-
 
|-
|05.28
+
|05:28
 
|'''Value''' can be duplicate.  
 
|'''Value''' can be duplicate.  
 
   
 
   
 
|-
 
|-
|05.30
+
|05:30
|It also holds '''value''' of any '''data type. '''
+
|It also holds '''value''' of any data type.  
 
   
 
   
 
|-
 
|-
|05.34
+
|05:34
|The syntax of '''hash''' is;
+
|The syntax of '''hash''' is:
  
 
|-
 
|-
|05.36
+
|05:36
 
|'''percentage variable name space equal to space open bracket '''
 
|'''percentage variable name space equal to space open bracket '''
  
 
 
|-
 
|-
|05.41
+
|05:41
|Press '''Enter '''
+
|Press '''Enter '''. '''single quote key Name single quote space equal to greater than sign space Value comma'''
 
+
+
 
   
 
   
 
|-
 
|-
|05.42
+
|  05:50
|'''single quote key Name single quote space equal to greater than sign space Value comma'''
+
+
|-
+
|  05.50
+
 
| Press '''Enter '''
 
| Press '''Enter '''
 
   
 
   
 
|-
 
|-
|  05.52
+
|  05:52
 
| '''single quote key Name single quote space equal to greater than sign space Value '''
 
| '''single quote key Name single quote space equal to greater than sign space Value '''
  
 
 
|-
 
|-
|05.58
+
|05:58
 
|Press '''Enter'''  
 
|Press '''Enter'''  
 
 
   
 
   
 
|-
 
|-
|  06.00
+
|  06:00
| close bracket semicolon  
+
| close bracket semicolon.
 
+
  
 
|-
 
|-
|  06.03
+
|  06:03
| Now let us look at an example of '''hash data structure'''.  
+
| Now let us look at an example of '''hash''' data structure.  
 
   
 
   
 
|-
 
|-
| 06.07
+
| 06:07
|  Switch to terminal and type  
+
|  Switch to terminal and type:
  
 
|-
 
|-
|  06.10
+
|  06:10
 
| '''gedit perlHash dot pl''' space '''&''' and press '''Enter.'''  
 
| '''gedit perlHash dot pl''' space '''&''' and press '''Enter.'''  
 
  
 
|-
 
|-
|  06.18
+
|  06:18
| This will open the '''perlHash dot pl''' file in '''gedit. '''
+
| This will open the 'perlHash dot pl' file in '''gedit.'''
  
 
|-
 
|-
|06.22
+
|06:22
 
|Type the following code as displayed on the screen.  
 
|Type the following code as displayed on the screen.  
  
 
 
|-
 
|-
|  06.27
+
|  06:27
 
|  This '''hash''' indicates the marks obtained in a subject.  
 
|  This '''hash''' indicates the marks obtained in a subject.  
 
 
   
 
   
 
|-
 
|-
|  06.31
+
|  06:31
| This example, shows the use of '''hash'''
+
| This example shows the use of '''hash'''.
  
 
|-
 
|-
|06.35
+
|06:35
|Now let us see how to print the '''hash'''
+
|Now, let us see how to print the '''hash'''.
 
+
 
   
 
   
 
|-
 
|-
| 06.38
+
| 06:38
 
| For now, just note the way I have printed the '''hash. '''
 
| For now, just note the way I have printed the '''hash. '''
  
 
 
|-
 
|-
| 06.42
+
| 06:42
 
|Detailed explanation will be given in  subsequent tutorial.  
 
|Detailed explanation will be given in  subsequent tutorial.  
  
 
|-
 
|-
|06.47
+
|06:47
 
|Press '''Ctrl + S''' to save the file.  
 
|Press '''Ctrl + S''' to save the file.  
  
 
|-
 
|-
|06.50
+
|06:50
|Then switch to  terminal and execute the '''Perl script''' as  
+
|Then switch to  terminal and execute the '''Perl script''' as:
  
 
 
|-
 
|-
| 06.55
+
| 06:55
 
|  '''perl perlHash dot pl''' and press '''Enter.'''  
 
|  '''perl perlHash dot pl''' and press '''Enter.'''  
  
 
|-
 
|-
| 07.01
+
| 07:01
| The following output is displayed on the terminal
+
| The following output is displayed on the terminal.
  
 
|-
 
|-
|  07.05
+
|  07:05
| Let us summarize.  
+
| Let us summarize. In this tutorial, we have learnt -  
+
|-
+
|  07.06
+
In this tutorial, we have learnt -  
+
 
+
+
|-
+
|07.09
+
| '''scalar'''
+
 
   
 
   
 
|-
 
|-
|07.10
+
|07:09
|'''Array''' and  
+
|'''scalar''',  '''Array''' and  
 
   
 
   
 
|-
 
|-
|07.11
+
|07:11
  |'''Hash Data Structure''' in '''Perl'''  
+
| '''Hash Data Structure''' in '''Perl''',
 
 
 
 
 
|-
 
|-
| 07.13
+
| 07:13
| using sample programs.  
+
| using sample programs.  
 
   
 
   
 
|-
 
|-
|07.15
+
|07:15
| There is assignment for you -  
+
| There is an assignment for you -  
  
 
|-
 
|-
|07.17
+
|07:17
 
| Declare '''scalar variable'''  
 
| Declare '''scalar variable'''  
  
 
|-
 
|-
|07.19
+
|07:19
 
| Assign value of '''type float''' to it and then print it.  
 
| Assign value of '''type float''' to it and then print it.  
  
 
|-
 
|-
|07.23
+
|07:23
 
| Declare and print an array of colors 'Red', 'Yellow' and 'Green'.  
 
| Declare and print an array of colors 'Red', 'Yellow' and 'Green'.  
 
   
 
   
 
|-
 
|-
|07.28
+
|07:28
|Declare and print a '''hash''' of Employee Name and their department.  
+
| Declare and print a '''hash''' of '''Employee Name''' and their '''department'''.  
  
 
|-
 
|-
|07.33
+
|07:33
| Hint: ''' 'Employee' =>(equal to greater than sign)  'John'''' comma  
+
| Hint: 'Employee' =>(equal to greater than sign)  'John' comma  
  
 
|-
 
|-
|07.38
+
|07:38
| ''' 'Department' =>(equal to greater than sign) 'Engineering' '''
+
| 'Department' =>(equal to greater than sign) 'Engineering'.
 
+
  
 
|-
 
|-
|07.42
+
|07:42
|Watch the video available at the following link
+
|Watch the video available at the following link.
+
 
   
 
   
 
|-
 
|-
|07.46
+
|07:46
|It summaries the Spoken Tutorial project
+
|It summarizes the Spoken Tutorial project.
+
 
+
 
|-
 
|-
|07.49
+
|07:49
|If you do not have good bandwidth, you can download and watch it
+
|If you do not have good bandwidth, you can download and watch it.
 
   
 
   
 
|-
 
|-
| 07.53
+
| 07:53
| The Spoken Tutorial Project Team Conducts workshops using spoken tutorials
+
|The Spoken Tutorial project team: Conducts workshops using spoken tutorials.
+
 
   
 
   
 
|-
 
|-
|07.59
+
|07:59
|Gives certificates to those who pass an online  test
+
|Gives certificates to those who pass an online  test.
+
 
   
 
   
 
|-
 
|-
|08.03
+
|08:03
|For more details, please write to contact at spoken hyphen tutorial dot org
+
|For more details, please write to: contact at spoken hyphen tutorial dot org.
 
   
 
   
 
|-
 
|-
| 08.10
+
| 08:10
|  Spoken Tutorial Project is a part of the Talk to a  Teacher project
+
"Spoken Tutorial" project is a part of the "Talk to a  Teacher" project.
+
 
+
 
|-
 
|-
|08.15
+
|08:15
 
|It is supported by the National Mission on Education through ICT, MHRD, Government of India.
 
|It is supported by the National Mission on Education through ICT, MHRD, Government of India.
 
 
   
 
   
 
|-
 
|-
|08.22
+
|08:22
|More information on this Mission is available at spoken hyphen tutorial dot org slash NMEICT hyphen Intro
+
|More information on this mission is available at: spoken hyphen tutorial dot org slash NMEICT hyphen Intro.
 
   
 
   
 
|-
 
|-
| 08.33
+
| 08:33
| Hope you enjoyed this Perl tutorial.  
+
|Hope you enjoyed this '''Perl''' tutorial.  
 
   
 
   
 
|-
 
|-
|08.35
+
|08:35
|This is Amol signing off.
+
|This is Amol, signing off.
+
 
+
 
|-
 
|-
|08.38
+
|08:38
 
|Thanks for joining.
 
|Thanks for joining.
 
   
 
   
 
|}
 
|}

Latest revision as of 12:33, 24 March 2017

Time Narration
00:00 Welcome to the spoken tutorial on Data Structures in Perl.
00:05 In this tutorial, we will learn about Data Structures available in Perl.
00:11 Here, I am using Ubuntu Linux 12.04 operating system and Perl 5.14.2.
00:18 I will also be using the gedit Text Editor.
00:22 You can use any text editor of your choice.
00:25 You should have basic knowledge of variables in Perl.
00:29 Knowledge of comments, loops and conditional statements will be an added advantage.
00:36 Please go through the relevant spoken tutorials on the Spoken Tutorial website.
00:41 Perl has 3 types of data structures:
00:44 Scalar, Array
00:46 Hash, also called as Associative Array.
00:50 Scalar: This type of data structure holds a value of any data type.
00:56 The data type can be string, number, double etc.
01:01 It can also hold the reference to an array or reference to a hash.
01:06 Note: Reference in Perl will be covered in subsequent tutorial.
01:11 Scalar type of data structure is as simple as declaring the variable.
01:16 $count = 12 semicolon.
01:20 $string = in single quote 'I am scalar of type string' semicolon.
01:26 We can perform the following operations on scalar.
01:30 Assign a value to it.
01:32 Assign one scalar to another.
01:35 Arithmetic operations on number type of scalars like add, subtract etc.
01:41 String operations on string scalar like concatenation, substr etc.
01:48 Now, let us look at an example of scalar data structure.
01:52 Switch to terminal and type: gedit scalars dot pl space & (ampersand) and press Enter.
02:01 This will open the 'scalars dot pl' file in gedit.
02:05 Type the following code as displayed on the screen.
02:09 This is the declaration and assignment to the scalar.
02:13 These are few arithmetic operations that can be performed on number type of scalar.
02:19 These are the string operations that can be performed on string type of scalar.
02:25 substr is the PERL function which provides part of the string as output.
02:30 Here, index 0 (zero) specifies start of a string, i.e. from where we want to start extraction of the string.
02:39 And, 11 specifies the offset upto where we want the string to be in the output.
02:46 Press Ctrl + s to save the file.
02:50 Then switch to the terminal and execute the Perl script as:
02:55 perl scalars dot pl and press Enter.
03:00 The output shown on terminal is as highlighted.
03:05 Now, let us look at an array data structure in PERL.
03:09 Array: It is a list of elements.
03:12 Elements can be string, number etc.
03:16 It has an index which is used for performing various operations on the array.
03:22 Index starts with zero.
03:25 Unlike other programming languages, there is no need to declare an array or its length before using it in Perl.
03:33 Perl array stretches or shrinks as per the elements added or removed from it.
03:39 The syntax to write an array is:
03:41 at the rate (@) variableName space equal to space open bracket list of elements separated with comma close bracket semicolon.
03:54 Now, let us look at an example of array data structure.
03:57 Switch to terminal and type: gedit perlArray dot pl space & and press Enter.
04:08 This will open the perlArray dot pl file in gedit.
04:12 Type the following code as displayed on the screen.
04:18 This is the number array which has elements of number type.
04:23 This is the string array which has elements of string type.
04:29 This array has elements of both number and string type.
04:34 This example shows the various types of arrays in Perl.
04:39 This is how we can print the array in Perl.
04:43 Press Ctrl + S to save the file.
04:47 Then switch to terminal and execute the Perl script as:
04:52 perl perlArray dot pl and press Enter.
04:59 The following output is displayed on the terminal.
05:04 Now, let us look at Hash data structure in Perl.
05:08 Hash is alternatively called as Associative array.
05:12 It is a Key - Value pair data structure.
05:15 Key in hash is unique.
05:18 If the same key is added again, then the value of that key will be overridden by the latest value assigned to the key.
05:28 Value can be duplicate.
05:30 It also holds value of any data type.
05:34 The syntax of hash is:
05:36 percentage variable name space equal to space open bracket
05:41 Press Enter . single quote key Name single quote space equal to greater than sign space Value comma
05:50 Press Enter
05:52 single quote key Name single quote space equal to greater than sign space Value
05:58 Press Enter
06:00 close bracket semicolon.
06:03 Now let us look at an example of hash data structure.
06:07 Switch to terminal and type:
06:10 gedit perlHash dot pl space & and press Enter.
06:18 This will open the 'perlHash dot pl' file in gedit.
06:22 Type the following code as displayed on the screen.
06:27 This hash indicates the marks obtained in a subject.
06:31 This example shows the use of hash.
06:35 Now, let us see how to print the hash.
06:38 For now, just note the way I have printed the hash.
06:42 Detailed explanation will be given in subsequent tutorial.
06:47 Press Ctrl + S to save the file.
06:50 Then switch to terminal and execute the Perl script as:
06:55 perl perlHash dot pl and press Enter.
07:01 The following output is displayed on the terminal.
07:05 Let us summarize. In this tutorial, we have learnt -
07:09 scalar, Array and
07:11 Hash Data Structure in Perl,
07:13 using sample programs.
07:15 There is an assignment for you -
07:17 Declare scalar variable
07:19 Assign value of type float to it and then print it.
07:23 Declare and print an array of colors 'Red', 'Yellow' and 'Green'.
07:28 Declare and print a hash of Employee Name and their department.
07:33 Hint: 'Employee' =>(equal to greater than sign) 'John' comma
07:38 'Department' =>(equal to greater than sign) 'Engineering'.
07:42 Watch the video available at the following link.
07:46 It summarizes the Spoken Tutorial project.
07:49 If you do not have good bandwidth, you can download and watch it.
07:53 The Spoken Tutorial project team: Conducts workshops using spoken tutorials.
07:59 Gives certificates to those who pass an online test.
08:03 For more details, please write to: contact at spoken hyphen tutorial dot org.
08:10 "Spoken Tutorial" project is a part of the "Talk to a Teacher" project.
08:15 It is supported by the National Mission on Education through ICT, MHRD, Government of India.
08:22 More information on this mission is available at: spoken hyphen tutorial dot org slash NMEICT hyphen Intro.
08:33 Hope you enjoyed this Perl tutorial.
08:35 This is Amol, signing off.
08:38 Thanks for joining.

Contributors and Content Editors

Gaurav, PoojaMoolya, Sandhya.np14