This document provides a tutorial on the Perl programming language. It covers basic Perl concepts like numbers, strings, variables, arrays, and control structures. Key points include double-precision numbers, single and double-quoted strings, scalar and array variables, comparison and logical operators, and functions for input/output, flow control and array manipulation. The document aims to teach Perl fundamentals through examples and exercises.
This document provides an introduction and overview of the Perl programming language. It discusses Perl's history and popularity, data types like scalars, arrays, and hashes, control structures, loops, functions, and common string and time manipulation functions. The tutorial aims to introduce basic Perl concepts like variables, printing, and functions through a simple "Hello World" example. It also outlines pros and cons of Perl for scripting and highlights some of its strengths in text processing.
This document provides a brief summary of Perl programming concepts including scalars, arrays, regular expressions, file handling, control structures, and functions. It covers basic syntax such as using semicolons, comments, variables, operators, and built-in variables. Array manipulation like indexing, pushing, and popping elements is described. File I/O using open, close and reading from files or standard streams is outlined. Common control structures like if/else, foreach, and while are listed along with comparison and logical operators. Regular expressions for pattern matching and substitution are covered including special characters.
This document provides a summary of a lecture on advanced Perl programming. It discusses how to sort arrays numerically and in descending order, explains the difference between the 'chop' and 'chomp' functions, and shows how to read from one file and write to another with line numbers. It also reviews how Perl evaluates Boolean expressions, the meaning of the <ARGV> file handle, and how to exit a loop using constructs like 'last' and 'next'. Quiz questions are provided to test comprehension of topics covered in the lecture.
PHP strings allow storing and manipulating text data. A string is a series of characters that can contain any number of characters limited only by available memory. Strings can be written using single quotes, double quotes, or heredoc syntax. Special characters in strings must be escaped using a backslash. PHP provides many built-in functions for working with strings like concatenation, comparison, searching, replacing, extracting, splitting, joining, formatting and more. Regular expressions provide powerful pattern matching capabilities for strings and PHP has functions like preg_match() for searching strings using regex patterns.
This document provides an overview of key Perl concepts including scalars, arrays, hashes, I/O, operators, and control structures. It discusses scalar data types like strings and numbers. It also covers arrays, hashes, and common functions for each. The document outlines I/O with the console, files, and handles. It briefly summarizes operators and precedence. Finally, it discusses control structures like if/else, loops, and modifiers.
Strings in PHP can represent text data and be manipulated using a variety of functions. Strings can be interpolated with variable values, accessed as arrays to retrieve individual characters, searched using functions like strpos(), and formatted for output. Common string operations include searching, replacing, comparing values, and extracting/modifying substrings.
This document provides an overview of the Perl programming language and includes examples of common Perl constructs. It discusses getting started with Perl, printing, variables, arrays, loops, conditionals, regular expressions, file handling and subroutines. Code snippets are provided to demonstrate various Perl features such as accessing array elements, for/while loops, pattern matching with regular expressions, splitting strings, and defining subroutines.
This document provides an overview of string functions and operations in PHP including: concatenating strings with operators, using single and double quotes, the heredoc syntax, string length with strlen(), finding substrings with strpos(), replacing substrings with str_replace(), converting case with strtoupper(), strtolower(), and ucfirst(), stripping whitespace with trim(), and examples of each.
This document provides an introduction and overview of the Perl programming language. It discusses Perl's history and popularity, data types like scalars, arrays, and hashes, control structures, loops, functions, and common string and time manipulation functions. The tutorial aims to introduce basic Perl concepts like variables, printing, and functions through a simple "Hello World" example. It also outlines pros and cons of Perl for scripting and highlights some of its strengths in text processing.
This document provides a brief summary of Perl programming concepts including scalars, arrays, regular expressions, file handling, control structures, and functions. It covers basic syntax such as using semicolons, comments, variables, operators, and built-in variables. Array manipulation like indexing, pushing, and popping elements is described. File I/O using open, close and reading from files or standard streams is outlined. Common control structures like if/else, foreach, and while are listed along with comparison and logical operators. Regular expressions for pattern matching and substitution are covered including special characters.
This document provides a summary of a lecture on advanced Perl programming. It discusses how to sort arrays numerically and in descending order, explains the difference between the 'chop' and 'chomp' functions, and shows how to read from one file and write to another with line numbers. It also reviews how Perl evaluates Boolean expressions, the meaning of the <ARGV> file handle, and how to exit a loop using constructs like 'last' and 'next'. Quiz questions are provided to test comprehension of topics covered in the lecture.
PHP strings allow storing and manipulating text data. A string is a series of characters that can contain any number of characters limited only by available memory. Strings can be written using single quotes, double quotes, or heredoc syntax. Special characters in strings must be escaped using a backslash. PHP provides many built-in functions for working with strings like concatenation, comparison, searching, replacing, extracting, splitting, joining, formatting and more. Regular expressions provide powerful pattern matching capabilities for strings and PHP has functions like preg_match() for searching strings using regex patterns.
This document provides an overview of key Perl concepts including scalars, arrays, hashes, I/O, operators, and control structures. It discusses scalar data types like strings and numbers. It also covers arrays, hashes, and common functions for each. The document outlines I/O with the console, files, and handles. It briefly summarizes operators and precedence. Finally, it discusses control structures like if/else, loops, and modifiers.
Strings in PHP can represent text data and be manipulated using a variety of functions. Strings can be interpolated with variable values, accessed as arrays to retrieve individual characters, searched using functions like strpos(), and formatted for output. Common string operations include searching, replacing, comparing values, and extracting/modifying substrings.
This document provides an overview of the Perl programming language and includes examples of common Perl constructs. It discusses getting started with Perl, printing, variables, arrays, loops, conditionals, regular expressions, file handling and subroutines. Code snippets are provided to demonstrate various Perl features such as accessing array elements, for/while loops, pattern matching with regular expressions, splitting strings, and defining subroutines.
This document provides an overview of string functions and operations in PHP including: concatenating strings with operators, using single and double quotes, the heredoc syntax, string length with strlen(), finding substrings with strpos(), replacing substrings with str_replace(), converting case with strtoupper(), strtolower(), and ucfirst(), stripping whitespace with trim(), and examples of each.
This document provides an overview of strings in PHP. It discusses single and double quote strings and how they differ in handling escape sequences and variable interpolation. It also covers the heredoc syntax. The document explains functions for comparing, manipulating, and extracting substrings from strings. These include strcmp(), strlen(), substr(), and regular expression functions. It provides examples of escaping characters, accessing strings as arrays, and using strings with functions like number_format(). Overall, the document is a guide to the basics of strings and common string functions in PHP.
The document provides an overview of the topics to be covered in a basic Perl programming course, including an introduction to Perl, variables, control structures, loops, subroutines, regular expressions, Boolean logic, and file handling. The agenda lists the main topics as Perl introduction, variables, control structures, loops, defining and using subroutines, regular expressions, using Boolean logic for true/false conditions, and file handling. Examples are then provided for many of the programming concepts.
This document provides an introduction to Perl programming including:
- The structure of a Perl program with the #! line and .pl extension. Hello world example.
- How to run Perl programs with the perl command or chmod.
- Core Perl concepts like scalars, lists, arrays, hashes, conditionals, loops, subroutines and file handling.
- Details on common Perl data types like strings, numbers, lists, arrays and hashes. Operations for each type.
- How to write comments, accept user input, define subroutines and handle variable scopes.
- Recommendation to use "strict" for better code quality by declaring variables.
- Overview of
PHP is a server-side scripting language that is embedded into HTML files. The goal is to generate client-side code like HTML, CSS, and JavaScript. PHP files are executed on the web server and must be saved in a subdirectory that is accessible to the server, like /var/www. PHP allows variables, operators, conditional statements, loops, functions, and arrays. Sessions and cookies can be used to store and retrieve information across multiple requests.
This document provides a 3-sentence summary of a Perl programming course document on syntax:
The document covers Perl programming syntax including declarations, statements, comments, operators, loops, and conditionals. Sections include declarations of variables and subroutines, simple and compound statements, comments and documentation, conditional statements, loops and loop control, logical and mathematical operators, and operator precedence. The goal of the course is to teach the essential Perl syntax for writing Perl programs.
This is the third set of slightly updated slides from a Perl programming course that I held some years ago.
I want to share it with everyone looking for intransitive Perl-knowledge.
A table of content for all presentations can be found at i-can.eu.
The source code for the examples and the presentations in ODP format are on https://github.com/kberov/PerlProgrammingCourse
This document provides an introduction and overview of key PHP concepts including variables, constants, strings, loops, conditional statements, functions, include/require, and variable scope. It includes code examples for while, do-while, for, and foreach loops. Conditional statements covered include if, elseif, else, switch, ternary operator. The document also discusses functions, passing by value vs reference, variable-length parameters, and returning values. It covers including/requiring files and variable scope rules. Finally, it provides exercises to reinforce the concepts.
This document discusses PHP functions and arrays. It covers basic syntax for defining functions, returning values from functions, and variable scope. It also covers array basics like indexing and printing arrays, as well as operations like sorting, searching, and iterating over arrays. Functions for stacks, queues and sets using arrays are also demonstrated. The document is a comprehensive reference for working with functions and arrays in PHP.
Presentation made at GTA meetup in 2012-02-07.
Object Calisthenics is a set of exercise rules to reach better code, maintainable, testable and readable.
This document provides an overview of the Perl programming language. It introduces key Perl concepts like data types, scalars, arrays, hashes, flow control, input/output, and operators. Perl allows variables to be of any type and handles automatic type conversion. It supports common data structures like arrays and associative arrays (hashes). Subroutines provide modularity and scoping rules determine variable visibility. Perl scripts can process command line arguments, files, and network connections.
This document provides an introduction to PHP including:
- PHP code uses <?php ?> tags and semicolons to end statements. It is loosely typed and supports variables, arrays, and objects.
- Built-in variables like $_GET and $_SERVER provide access to server and request data. Strings support escape sequences and variable interpolation.
- PHP has advantages like being open source, easy to learn, and having a large community, but disadvantages include loose syntax that can cause errors and previous lack of object orientation.
The document discusses the concept of Object Calisthenics, which are programming guidelines aimed at writing better object-oriented code. It specifically outlines 9 guidelines/rules adapted for PHP programming:
1. Only one level of indentation per method.
2. Do not use the 'else' keyword.
3. Wrap all primitive data types and strings in objects.
4. Collections of objects should be first-class objects.
5. Only call one method on an object per line.
6. Do not abbreviate names.
7. Keep classes small with under 200 lines of code and 10 methods.
8. Limit the number of instance variables in a class to 2-5.
9
This document provides an introduction and overview of the Perl programming language. It discusses the history and uses of Perl, basic Perl syntax and data types, control structures, functions, input/output, and how to use Perl for CGI web development. The key points covered include the origins and popularity of Perl, its pros and cons, how to write "Hello World" programs, define variables and data types, use conditional and loop statements, define and call functions, perform I/O, and generate HTML using CGI.pm for building dynamic web pages and applications with Perl.
This document provides an overview of string matching and regular expression functions in Perl. It defines functions like split and join for manipulating strings. It explains different ways of specifying regular expressions using delimiters and modifiers. Special variables like $', $& and $` that capture matched strings are also described. Examples are given to illustrate string substitution operators and capturing matched text using parentheses in regular expressions.
The document summarizes a Perl Mongers course on data and operators in Perl. It covers basic data types like scalars, arrays, and hashes. It describes strings, numbers, and how to perform operations on them. It also discusses control structures like conditionals and loops for program flow. Finally, it mentions input/output functions like STDIN and STDOUT.
This document provides an overview of the Perl programming language and includes examples of common Perl scripts and functions. It discusses getting started with Perl, printing, variables, arrays, loops, conditionals, regular expressions, file handling and subroutines. Code snippets are provided to demonstrate concepts like opening and reading files, splitting strings, calculating averages and more. The document serves as a tutorial for beginners to learn the basics of Perl programming.
This document provides a brief summary of Perl programming concepts including scalars, arrays, regular expressions, file handling, control structures, and functions. It covers basic syntax such as using semicolons, comments, variables, operators, and built-in variables. Array manipulation like indexing, pushing, and popping elements is described. File I/O using open, close and reading from files or standard streams is outlined. Common control structures like if/else, foreach, and while are listed along with comparison and logical operators. Regular expressions for pattern matching and substitution are covered including special characters.
This document provides a brief summary of Perl programming concepts including scalars, arrays, regular expressions, file handling, control structures, and functions. It covers basic syntax such as using semicolons, comments, variables, operators, and built-in variables. Array manipulation like indexing, pushing, and popping elements is described. File I/O using open, close and reading from files or standard streams is outlined. Common control structures like if/else, for loops, and while loops are listed. Regular expressions for pattern matching and substitution are summarized along with special characters. Miscellaneous functions and defining subroutines are also mentioned.
This document provides a brief summary of Perl programming concepts including scalars, arrays, regular expressions, file handling, control structures, and functions. It covers basic syntax such as using semicolons, comments, variables, operators, and built-in variables. Array manipulation like indexing, pushing, and popping elements is described. File I/O using open, close and reading from files or standard streams is outlined. Common control structures like if/else, foreach, and while are listed along with comparison and logical operators. Regular expressions for pattern matching and substitution are covered including special characters.
The document discusses Perl control structures and arrays. It explains that a statement block contains a sequence of statements enclosed in curly braces. It also discusses if/else conditional statements and unless conditional statements. The document then explains that arrays are a special type of variable that stores list data types, with each element being a string, number, or other scalar. Array variables are prefixed with an @ symbol. It provides examples of defining and accessing array elements and using array slices.
This document provides an overview of the Perl programming language. It discusses where Perl is commonly used, its key features like text processing and database access. It then covers various Perl concepts like scalars, variables, user input, strings, conditionals, loops, arrays, hashes, file handling and regular expressions. It provides examples for working with scalars, strings, conditionals, loops and arrays. It also discusses the special $_ variable and functions like pop, push, shift and unshift for manipulating arrays. The document concludes with a brief discussion of subroutines.
This is the second set of slightly updated slides from a Perl programming course that I held some years ago.
I want to share it with everyone looking for intransitive Perl-knowledge.
A table of content for all presentations can be found at i-can.eu.
The source code for the examples and the presentations in ODP format are on https://github.com/kberov/PerlProgrammingCourse
This document provides an overview of strings in PHP. It discusses single and double quote strings and how they differ in handling escape sequences and variable interpolation. It also covers the heredoc syntax. The document explains functions for comparing, manipulating, and extracting substrings from strings. These include strcmp(), strlen(), substr(), and regular expression functions. It provides examples of escaping characters, accessing strings as arrays, and using strings with functions like number_format(). Overall, the document is a guide to the basics of strings and common string functions in PHP.
The document provides an overview of the topics to be covered in a basic Perl programming course, including an introduction to Perl, variables, control structures, loops, subroutines, regular expressions, Boolean logic, and file handling. The agenda lists the main topics as Perl introduction, variables, control structures, loops, defining and using subroutines, regular expressions, using Boolean logic for true/false conditions, and file handling. Examples are then provided for many of the programming concepts.
This document provides an introduction to Perl programming including:
- The structure of a Perl program with the #! line and .pl extension. Hello world example.
- How to run Perl programs with the perl command or chmod.
- Core Perl concepts like scalars, lists, arrays, hashes, conditionals, loops, subroutines and file handling.
- Details on common Perl data types like strings, numbers, lists, arrays and hashes. Operations for each type.
- How to write comments, accept user input, define subroutines and handle variable scopes.
- Recommendation to use "strict" for better code quality by declaring variables.
- Overview of
PHP is a server-side scripting language that is embedded into HTML files. The goal is to generate client-side code like HTML, CSS, and JavaScript. PHP files are executed on the web server and must be saved in a subdirectory that is accessible to the server, like /var/www. PHP allows variables, operators, conditional statements, loops, functions, and arrays. Sessions and cookies can be used to store and retrieve information across multiple requests.
This document provides a 3-sentence summary of a Perl programming course document on syntax:
The document covers Perl programming syntax including declarations, statements, comments, operators, loops, and conditionals. Sections include declarations of variables and subroutines, simple and compound statements, comments and documentation, conditional statements, loops and loop control, logical and mathematical operators, and operator precedence. The goal of the course is to teach the essential Perl syntax for writing Perl programs.
This is the third set of slightly updated slides from a Perl programming course that I held some years ago.
I want to share it with everyone looking for intransitive Perl-knowledge.
A table of content for all presentations can be found at i-can.eu.
The source code for the examples and the presentations in ODP format are on https://github.com/kberov/PerlProgrammingCourse
This document provides an introduction and overview of key PHP concepts including variables, constants, strings, loops, conditional statements, functions, include/require, and variable scope. It includes code examples for while, do-while, for, and foreach loops. Conditional statements covered include if, elseif, else, switch, ternary operator. The document also discusses functions, passing by value vs reference, variable-length parameters, and returning values. It covers including/requiring files and variable scope rules. Finally, it provides exercises to reinforce the concepts.
This document discusses PHP functions and arrays. It covers basic syntax for defining functions, returning values from functions, and variable scope. It also covers array basics like indexing and printing arrays, as well as operations like sorting, searching, and iterating over arrays. Functions for stacks, queues and sets using arrays are also demonstrated. The document is a comprehensive reference for working with functions and arrays in PHP.
Presentation made at GTA meetup in 2012-02-07.
Object Calisthenics is a set of exercise rules to reach better code, maintainable, testable and readable.
This document provides an overview of the Perl programming language. It introduces key Perl concepts like data types, scalars, arrays, hashes, flow control, input/output, and operators. Perl allows variables to be of any type and handles automatic type conversion. It supports common data structures like arrays and associative arrays (hashes). Subroutines provide modularity and scoping rules determine variable visibility. Perl scripts can process command line arguments, files, and network connections.
This document provides an introduction to PHP including:
- PHP code uses <?php ?> tags and semicolons to end statements. It is loosely typed and supports variables, arrays, and objects.
- Built-in variables like $_GET and $_SERVER provide access to server and request data. Strings support escape sequences and variable interpolation.
- PHP has advantages like being open source, easy to learn, and having a large community, but disadvantages include loose syntax that can cause errors and previous lack of object orientation.
The document discusses the concept of Object Calisthenics, which are programming guidelines aimed at writing better object-oriented code. It specifically outlines 9 guidelines/rules adapted for PHP programming:
1. Only one level of indentation per method.
2. Do not use the 'else' keyword.
3. Wrap all primitive data types and strings in objects.
4. Collections of objects should be first-class objects.
5. Only call one method on an object per line.
6. Do not abbreviate names.
7. Keep classes small with under 200 lines of code and 10 methods.
8. Limit the number of instance variables in a class to 2-5.
9
This document provides an introduction and overview of the Perl programming language. It discusses the history and uses of Perl, basic Perl syntax and data types, control structures, functions, input/output, and how to use Perl for CGI web development. The key points covered include the origins and popularity of Perl, its pros and cons, how to write "Hello World" programs, define variables and data types, use conditional and loop statements, define and call functions, perform I/O, and generate HTML using CGI.pm for building dynamic web pages and applications with Perl.
This document provides an overview of string matching and regular expression functions in Perl. It defines functions like split and join for manipulating strings. It explains different ways of specifying regular expressions using delimiters and modifiers. Special variables like $', $& and $` that capture matched strings are also described. Examples are given to illustrate string substitution operators and capturing matched text using parentheses in regular expressions.
The document summarizes a Perl Mongers course on data and operators in Perl. It covers basic data types like scalars, arrays, and hashes. It describes strings, numbers, and how to perform operations on them. It also discusses control structures like conditionals and loops for program flow. Finally, it mentions input/output functions like STDIN and STDOUT.
This document provides an overview of the Perl programming language and includes examples of common Perl scripts and functions. It discusses getting started with Perl, printing, variables, arrays, loops, conditionals, regular expressions, file handling and subroutines. Code snippets are provided to demonstrate concepts like opening and reading files, splitting strings, calculating averages and more. The document serves as a tutorial for beginners to learn the basics of Perl programming.
This document provides a brief summary of Perl programming concepts including scalars, arrays, regular expressions, file handling, control structures, and functions. It covers basic syntax such as using semicolons, comments, variables, operators, and built-in variables. Array manipulation like indexing, pushing, and popping elements is described. File I/O using open, close and reading from files or standard streams is outlined. Common control structures like if/else, foreach, and while are listed along with comparison and logical operators. Regular expressions for pattern matching and substitution are covered including special characters.
This document provides a brief summary of Perl programming concepts including scalars, arrays, regular expressions, file handling, control structures, and functions. It covers basic syntax such as using semicolons, comments, variables, operators, and built-in variables. Array manipulation like indexing, pushing, and popping elements is described. File I/O using open, close and reading from files or standard streams is outlined. Common control structures like if/else, for loops, and while loops are listed. Regular expressions for pattern matching and substitution are summarized along with special characters. Miscellaneous functions and defining subroutines are also mentioned.
This document provides a brief summary of Perl programming concepts including scalars, arrays, regular expressions, file handling, control structures, and functions. It covers basic syntax such as using semicolons, comments, variables, operators, and built-in variables. Array manipulation like indexing, pushing, and popping elements is described. File I/O using open, close and reading from files or standard streams is outlined. Common control structures like if/else, foreach, and while are listed along with comparison and logical operators. Regular expressions for pattern matching and substitution are covered including special characters.
The document discusses Perl control structures and arrays. It explains that a statement block contains a sequence of statements enclosed in curly braces. It also discusses if/else conditional statements and unless conditional statements. The document then explains that arrays are a special type of variable that stores list data types, with each element being a string, number, or other scalar. Array variables are prefixed with an @ symbol. It provides examples of defining and accessing array elements and using array slices.
This document provides an overview of the Perl programming language. It discusses where Perl is commonly used, its key features like text processing and database access. It then covers various Perl concepts like scalars, variables, user input, strings, conditionals, loops, arrays, hashes, file handling and regular expressions. It provides examples for working with scalars, strings, conditionals, loops and arrays. It also discusses the special $_ variable and functions like pop, push, shift and unshift for manipulating arrays. The document concludes with a brief discussion of subroutines.
This is the second set of slightly updated slides from a Perl programming course that I held some years ago.
I want to share it with everyone looking for intransitive Perl-knowledge.
A table of content for all presentations can be found at i-can.eu.
The source code for the examples and the presentations in ODP format are on https://github.com/kberov/PerlProgrammingCourse
Perl is a high-level scripting language useful for tasks like parsing and restructuring data files, CGI scripts, and more. It was created in 1987 by Larry Wall as a "glue" language to connect systems. Perl code is compiled at runtime. Key features include regular expressions, hashes for associative arrays, object-oriented capabilities, and extensive standard and third-party libraries. Perl uses C-like syntax and data types like scalars, lists, and hashes. It supports control structures like if/else, for loops, and subroutines for modular programming. Perl is well-suited for text manipulation and system administration tasks.
Perl6 is a powerful programming language that incorporates many programming paradigms including functional, object oriented, reactive, and event based programming. It aims to provide programmers with a toolbox of features to build applications in many different styles. The language includes features like junctions, promises, channels, supplies, sets, roles, and strong support for Unicode. It also allows calling external native libraries and has built-in support for rational numbers, sequences, and lazy evaluation. Perl6 code examples are provided to demonstrate various features like List utilities, junctions, promises, channels/supplies, roles, and native calls. Further reading resources are also referenced.
Perl6 is a powerful programming language that incorporates many programming paradigms including functional, object-oriented, and reactive programming. It has built-in support for concepts like promises to handle asynchronous code, channels for communicating between asynchronous processes, and sets/bags for storing unique values. The language also has features for rational numbers, lazy evaluation, roles for composition, and easy integration with native libraries. Perl6 aims to provide programmers a flexible toolbox to build applications in many different styles.
The document discusses Perl arrays, scalars, and constants. Some key points:
- Arrays are prefixed with @ and hold a list of scalars. They can be assigned using @var = (value1, value2).
- Scalars represent a single value and are used to hold individual elements of an array.
- Constants are values that don't change, like numbers or defined strings. They don't require $ or @ prefixes.
The document discusses various techniques for extending and improving Perl, including both good and potentially evil techniques. It covers Perl modules that port Perl 6 features to Perl 5 like given/when switches and state variables. It also discusses techniques for runtime introspection and modification like PadWalker and source filters. The document advocates for continuing to extend Perl 5 with modern features to keep it relevant and powerful.
This document provides a summary of a tutorial on learning the Perl 6 programming language. It covers topics like scalars, variables, control structures, I/O, subroutines, regular expressions, modules, classes and objects. It suggests that in the 80 minute session, the presenters will be able to cover data, variables, control structures, I/O, subroutines and regular expressions, but may not have time for everything. It also provides information on getting started with Pugs and writing simple Perl 6 programs, as well as examples of core Perl 6 concepts like objects, methods, strings, arithmetic, conditionals and loops.
The document discusses scopes and arrays in Perl. It defines three scopes for identifiers in Perl - global, lexical, and dynamic. Global identifiers can be accessed from anywhere, lexical identifiers exist only in the block they are defined, and dynamic identifiers also exist in the called subroutines. The document also discusses array creation using lists, non-existing indices, the qw operator, and range operator. It demonstrates array manipulation functions like push, pop, shift, and unshift.
This document summarizes Python basics including its features, popularity in different fields and companies, data types, control flow, containers like lists and dictionaries, NumPy for numerical computing, and classes. Python is an interpreted, general-purpose language with rich library support. It is commonly used in computer science, data analysis, biology, and academic communities. Major companies like Google, Dropbox, and Instagram use Python.
This document summarizes Python basics including its features, popularity in different fields and companies, data types, control flow, containers like lists and dictionaries, NumPy for numerical computing, and classes. Python is an interpreted, general-purpose language with rich library support. It is commonly used in computer science, data analysis, biology, and academic communities. Major companies like Google, Dropbox, and Instagram use Python.
This document discusses various PHP functions categorized into different groups like:
- Date Functions: date, getdate, setdate, Checkdate, time, mktime
- String Functions: strtolower, strtoupper, strlen, trim, substr, strcmp etc.
- Math Functions: abs, ceil, floor, round, pow, sqrt, rand
- User Defined Functions: functions with arguments, default arguments, returning values
- File Handling Functions: fopen, fread, fwrite, fclose to handle files
- Miscellaneous Functions: define, constant, include, require, header to define constants, include files etc.
This document provides a help and tutorial for TopStyle Pro version 3.11. It covers getting started with TopStyle, editing style sheets and HTML/XHTML, working with colors, previews, validation, site management, reports, mappings, customization, and third-party integration. It also includes appendices on CSS basics and tips, TopStyle tips and tricks, style sheet resources, keyboard shortcuts, and regular expressions.
TopStyle Help & <b>Tutorial</b>tutorialsruby
This document provides a table of contents for the TopStyle Pro Help & Tutorial, which teaches how to use the TopStyle software for editing style sheets and HTML/XHTML documents. It lists over 50 sections that provide explanations and instructions for features like creating and opening files, editing styles, working with colors, previews, validation, site management, reports and customizing the software. The document was created by Giampaolo Bellavite from the online help provided with TopStyle version 3.11.
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting <b>...</b>tutorialsruby
This document provides the course outline for IMD 210 Fundamentals of Scripting Languages at The Art Institute of Atlanta during the Spring 2005 quarter. The course focuses on integrating programming concepts with interface design using scripting languages like JavaScript and CSS. It will cover topics like DOM, CSS layout, JavaScript variables, conditionals, and events. Students will complete 4 assignments including redesigning existing websites, and there will be weekly quizzes, a midterm, and final exam. The course is worth 4 credits and meets once a week for class and lab.
This document provides the course outline for IMD 210 Fundamentals of Scripting Languages at The Art Institute of Atlanta during the Spring 2005 quarter. The course focuses on integrating programming concepts with interface design using scripting languages like JavaScript and CSS. It will cover topics like DOM, CSS layout, JavaScript variables, conditionals, and events. Students will complete 4 assignments including redesigning existing websites, and there will be weekly quizzes, a midterm, and final exam. The course is worth 4 credits and meets once a week for class and lab.
The group aims to bridge gaps between peer-to-peer database architectures and scaling multimedia information retrieval. They develop a probabilistic multimedia database system with abstraction layers for applications and researchers. They also research challenges of peer-to-peer networks for distributed data management. Both lines are supported by the MonetDB platform to exploit custom hardware and adaptive query optimization. The goal is a modular solution linking theoretical optimal solutions to application demands under resource limitations.
Standardization and Knowledge Transfer – INS0tutorialsruby
The group aims to bridge gaps between peer-to-peer database architectures and scaling multimedia information retrieval. They develop a probabilistic multimedia database system with abstraction layers and a flexible model. They also research challenges of peer-to-peer networks for distributed data management. Both lines are supported by the MonetDB platform to exploit custom hardware and adaptive query optimization. The goal is a modular solution linking theoretical optimal solutions to application demands under resource limitations.
This document provides an introduction to converting HTML documents to XHTML, including the basic syntax changes needed like making all tags lowercase and closing all tags. It provides examples of correct XHTML markup for different tags. It also explains the new DOCTYPE declaration and shows a sample well-formed XHTML document incorporating all the discussed changes. Resources for learning more about XHTML are listed at the end.
This document provides an introduction to converting HTML documents to XHTML, including the basic syntax changes needed like making all tags lowercase and closing all tags. It provides examples of correct XHTML markup for different tags. It also explains the new DOCTYPE declaration and shows a sample well-formed XHTML document incorporating all the discussed changes. Resources for learning more about XHTML are listed at the end.
XHTML is a markup language that provides structure and semantics to web pages. It is based on XML and is more strict than HTML. XHTML pages must have a document type definition, html and head tags, and a body where the visible content goes. Common XHTML tags include paragraphs, lists, links, images, and divisions to logically separate content. While XHTML provides structure, CSS is used to style pages and control visual presentation by defining rules for tags. CSS rules are defined in external style sheets to keep presentation separate from structure and content.
XHTML is a markup language that provides structure and semantics to web pages. It is based on XML and is more strict than HTML. XHTML pages must have a document type definition, html and head tags, and a body where the visible content goes. Common XHTML tags include paragraphs, lists, links, images, and divisions to logically separate content. While XHTML provides structure, CSS is used to style pages and control visual presentation through rules that target specific XHTML elements.
This document discusses how to create and use external cascading style sheets (CSS) in Dreamweaver. It provides steps to:
1. Open the CSS Styles tab in Dreamweaver and create a new external CSS stylesheet using a sample text style.
2. Save the stylesheet and link it to a new HTML page to style elements like headings, text sizes, and boxes.
3. Edit existing styles by selecting a tag in the CSS Styles panel and modifying properties directly, or by clicking the tag and using the pencil icon to edit in a window. This allows customizing styles globally across all linked pages.
This document provides an overview of how to create and use cascading style sheets (CSS) in Dreamweaver. It describes the different types of style sheets, including external and internal style sheets. It outlines the steps to create an external style sheet in Dreamweaver using the CSS Styles panel and provides instructions for linking the external style sheet to an HTML page. The document demonstrates how to experiment with predefined styles and how to edit, add, and delete styles in the CSS stylesheet.
This document appears to be a weekly update from an intro to computer science course. It includes summaries of classmates' demographics, comfort levels, and prior experience. It also discusses time spent on problem sets and recommends upcoming courses in CS51 and CS61. Finally, it recommends reading on TCP/IP, HTTP, XHTML, CSS, PHP, SQL and using the bulletin board for questions.
This document appears to be a weekly update from an intro to computer science course. It includes summaries of classmates' demographics, comfort levels, and prior experience. It also discusses time spent on problem sets and recommends upcoming courses in CS51 and CS61. Finally, it recommends reading on topics like TCP/IP, HTTP, XHTML, CSS, PHP, SQL and using bulletin boards, and includes images related to these topics.
The document discusses how to use Cascading Style Sheets (CSS) with Corvid Servlet Runtime templates to control formatting and layout. CSS allows separating design from content, making templates simpler and easier to maintain. It also enables adapting appearance for different devices. The document provides examples of using CSS classes to style template elements and explains how to set up a demo system using the included CSS and templates.
The document discusses how to use Cascading Style Sheets (CSS) with Corvid Servlet Runtime templates to control formatting and layout. CSS allows separating design from content, making templates simpler and easier to maintain. It also enables customization of appearance for different devices. The document provides examples of how to apply CSS classes and rules to Corvid template elements to control fonts, colors, positioning and more.
The document provides an introduction to CSS and how it works with HTML to control the presentation and styling of web page content. It explains basic CSS concepts like selectors, properties and values, and how CSS rules are used to target specific HTML elements and style them. Examples are given of common CSS properties and selectors and how they can be used to style elements and format the layout of web pages.
The document introduces CSS and how it works with HTML to separate content from presentation, allowing the styling of web pages through rules that target HTML elements. It explains CSS syntax and various selectors like type, class, ID, and descendant selectors. Examples are provided of how CSS can be used to style properties like color, font, padding, and layout of elements on a page.
Cascading Style Sheets (CSS) allow users to define how HTML elements are presented on a page. CSS enables changing the appearance and layout of an entire website by editing just one CSS file. CSS uses selectors to apply styles to HTML elements via properties and values. Styles can be defined internally in HTML or externally in CSS files. CSS can control text formatting, colors, spacing, positioning and more to achieve visual consistency across web pages.
Cascading Style Sheets (CSS) allow users to define how HTML elements are presented on a page. CSS enables changing the appearance and layout of an entire website by editing just one CSS file. CSS uses selectors to apply styles to HTML elements via properties and values. Styles can be defined internally in HTML or externally in CSS files. CSS can control text formatting, colors, spacing, positioning and more to achieve visual consistency across web pages.
5th LF Energy Power Grid Model Meet-up SlidesDanBrown980551
5th Power Grid Model Meet-up
It is with great pleasure that we extend to you an invitation to the 5th Power Grid Model Meet-up, scheduled for 6th June 2024. This event will adopt a hybrid format, allowing participants to join us either through an online Mircosoft Teams session or in person at TU/e located at Den Dolech 2, Eindhoven, Netherlands. The meet-up will be hosted by Eindhoven University of Technology (TU/e), a research university specializing in engineering science & technology.
Power Grid Model
The global energy transition is placing new and unprecedented demands on Distribution System Operators (DSOs). Alongside upgrades to grid capacity, processes such as digitization, capacity optimization, and congestion management are becoming vital for delivering reliable services.
Power Grid Model is an open source project from Linux Foundation Energy and provides a calculation engine that is increasingly essential for DSOs. It offers a standards-based foundation enabling real-time power systems analysis, simulations of electrical power grids, and sophisticated what-if analysis. In addition, it enables in-depth studies and analysis of the electrical power grid’s behavior and performance. This comprehensive model incorporates essential factors such as power generation capacity, electrical losses, voltage levels, power flows, and system stability.
Power Grid Model is currently being applied in a wide variety of use cases, including grid planning, expansion, reliability, and congestion studies. It can also help in analyzing the impact of renewable energy integration, assessing the effects of disturbances or faults, and developing strategies for grid control and optimization.
What to expect
For the upcoming meetup we are organizing, we have an exciting lineup of activities planned:
-Insightful presentations covering two practical applications of the Power Grid Model.
-An update on the latest advancements in Power Grid -Model technology during the first and second quarters of 2024.
-An interactive brainstorming session to discuss and propose new feature requests.
-An opportunity to connect with fellow Power Grid Model enthusiasts and users.
Discover top-tier mobile app development services, offering innovative solutions for iOS and Android. Enhance your business with custom, user-friendly mobile applications.
For the full video of this presentation, please visit: https://www.edge-ai-vision.com/2024/06/temporal-event-neural-networks-a-more-efficient-alternative-to-the-transformer-a-presentation-from-brainchip/
Chris Jones, Director of Product Management at BrainChip , presents the “Temporal Event Neural Networks: A More Efficient Alternative to the Transformer” tutorial at the May 2024 Embedded Vision Summit.
The expansion of AI services necessitates enhanced computational capabilities on edge devices. Temporal Event Neural Networks (TENNs), developed by BrainChip, represent a novel and highly efficient state-space network. TENNs demonstrate exceptional proficiency in handling multi-dimensional streaming data, facilitating advancements in object detection, action recognition, speech enhancement and language model/sequence generation. Through the utilization of polynomial-based continuous convolutions, TENNs streamline models, expedite training processes and significantly diminish memory requirements, achieving notable reductions of up to 50x in parameters and 5,000x in energy consumption compared to prevailing methodologies like transformers.
Integration with BrainChip’s Akida neuromorphic hardware IP further enhances TENNs’ capabilities, enabling the realization of highly capable, portable and passively cooled edge devices. This presentation delves into the technical innovations underlying TENNs, presents real-world benchmarks, and elucidates how this cutting-edge approach is positioned to revolutionize edge AI across diverse applications.
Fueling AI with Great Data with Airbyte WebinarZilliz
This talk will focus on how to collect data from a variety of sources, leveraging this data for RAG and other GenAI use cases, and finally charting your course to productionalization.
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor IvaniukFwdays
At this talk we will discuss DDoS protection tools and best practices, discuss network architectures and what AWS has to offer. Also, we will look into one of the largest DDoS attacks on Ukrainian infrastructure that happened in February 2022. We'll see, what techniques helped to keep the web resources available for Ukrainians and how AWS improved DDoS protection for all customers based on Ukraine experience
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...Jason Yip
The typical problem in product engineering is not bad strategy, so much as “no strategy”. This leads to confusion, lack of motivation, and incoherent action. The next time you look for a strategy and find an empty space, instead of waiting for it to be filled, I will show you how to fill it in yourself. If you’re wrong, it forces a correction. If you’re right, it helps create focus. I’ll share how I’ve approached this in the past, both what works and lessons for what didn’t work so well.
The Microsoft 365 Migration Tutorial For Beginner.pptxoperationspcvita
This presentation will help you understand the power of Microsoft 365. However, we have mentioned every productivity app included in Office 365. Additionally, we have suggested the migration situation related to Office 365 and how we can help you.
You can also read: https://www.systoolsgroup.com/updates/office-365-tenant-to-tenant-migration-step-by-step-complete-guide/
Dandelion Hashtable: beyond billion requests per second on a commodity serverAntonios Katsarakis
This slide deck presents DLHT, a concurrent in-memory hashtable. Despite efforts to optimize hashtables, that go as far as sacrificing core functionality, state-of-the-art designs still incur multiple memory accesses per request and block request processing in three cases. First, most hashtables block while waiting for data to be retrieved from memory. Second, open-addressing designs, which represent the current state-of-the-art, either cannot free index slots on deletes or must block all requests to do so. Third, index resizes block every request until all objects are copied to the new index. Defying folklore wisdom, DLHT forgoes open-addressing and adopts a fully-featured and memory-aware closed-addressing design based on bounded cache-line-chaining. This design offers lock-free index operations and deletes that free slots instantly, (2) completes most requests with a single memory access, (3) utilizes software prefetching to hide memory latencies, and (4) employs a novel non-blocking and parallel resizing. In a commodity server and a memory-resident workload, DLHT surpasses 1.6B requests per second and provides 3.5x (12x) the throughput of the state-of-the-art closed-addressing (open-addressing) resizable hashtable on Gets (Deletes).
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectorsDianaGray10
Join us to learn how UiPath Apps can directly and easily interact with prebuilt connectors via Integration Service--including Salesforce, ServiceNow, Open GenAI, and more.
The best part is you can achieve this without building a custom workflow! Say goodbye to the hassle of using separate automations to call APIs. By seamlessly integrating within App Studio, you can now easily streamline your workflow, while gaining direct access to our Connector Catalog of popular applications.
We’ll discuss and demo the benefits of UiPath Apps and connectors including:
Creating a compelling user experience for any software, without the limitations of APIs.
Accelerating the app creation process, saving time and effort
Enjoying high-performance CRUD (create, read, update, delete) operations, for
seamless data management.
Speakers:
Russell Alfeche, Technology Leader, RPA at qBotic and UiPath MVP
Charlie Greenberg, host
Generating privacy-protected synthetic data using Secludy and MilvusZilliz
During this demo, the founders of Secludy will demonstrate how their system utilizes Milvus to store and manipulate embeddings for generating privacy-protected synthetic data. Their approach not only maintains the confidentiality of the original data but also enhances the utility and scalability of LLMs under privacy constraints. Attendees, including machine learning engineers, data scientists, and data managers, will witness first-hand how Secludy's integration with Milvus empowers organizations to harness the power of LLMs securely and efficiently.
Skybuffer SAM4U tool for SAP license adoptionTatiana Kojar
Manage and optimize your license adoption and consumption with SAM4U, an SAP free customer software asset management tool.
SAM4U, an SAP complimentary software asset management tool for customers, delivers a detailed and well-structured overview of license inventory and usage with a user-friendly interface. We offer a hosted, cost-effective, and performance-optimized SAM4U setup in the Skybuffer Cloud environment. You retain ownership of the system and data, while we manage the ABAP 7.58 infrastructure, ensuring fixed Total Cost of Ownership (TCO) and exceptional services through the SAP Fiori interface.
AppSec PNW: Android and iOS Application Security with MobSFAjin Abraham
Mobile Security Framework - MobSF is a free and open source automated mobile application security testing environment designed to help security engineers, researchers, developers, and penetration testers to identify security vulnerabilities, malicious behaviours and privacy concerns in mobile applications using static and dynamic analysis. It supports all the popular mobile application binaries and source code formats built for Android and iOS devices. In addition to automated security assessment, it also offers an interactive testing environment to build and execute scenario based test/fuzz cases against the application.
This talk covers:
Using MobSF for static analysis of mobile applications.
Interactive dynamic security assessment of Android and iOS applications.
Solving Mobile app CTF challenges.
Reverse engineering and runtime analysis of Mobile malware.
How to shift left and integrate MobSF/mobsfscan SAST and DAST in your build pipeline.
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfChart Kalyan
A Mix Chart displays historical data of numbers in a graphical or tabular form. The Kalyan Rajdhani Mix Chart specifically shows the results of a sequence of numbers over different periods.
Driving Business Innovation: Latest Generative AI Advancements & Success StorySafe Software
Are you ready to revolutionize how you handle data? Join us for a webinar where we’ll bring you up to speed with the latest advancements in Generative AI technology and discover how leveraging FME with tools from giants like Google Gemini, Amazon, and Microsoft OpenAI can supercharge your workflow efficiency.
During the hour, we’ll take you through:
Guest Speaker Segment with Hannah Barrington: Dive into the world of dynamic real estate marketing with Hannah, the Marketing Manager at Workspace Group. Hear firsthand how their team generates engaging descriptions for thousands of office units by integrating diverse data sources—from PDF floorplans to web pages—using FME transformers, like OpenAIVisionConnector and AnthropicVisionConnector. This use case will show you how GenAI can streamline content creation for marketing across the board.
Ollama Use Case: Learn how Scenario Specialist Dmitri Bagh has utilized Ollama within FME to input data, create custom models, and enhance security protocols. This segment will include demos to illustrate the full capabilities of FME in AI-driven processes.
Custom AI Models: Discover how to leverage FME to build personalized AI models using your data. Whether it’s populating a model with local data for added security or integrating public AI tools, find out how FME facilitates a versatile and secure approach to AI.
We’ll wrap up with a live Q&A session where you can engage with our experts on your specific use cases, and learn more about optimizing your data workflows with AI.
This webinar is ideal for professionals seeking to harness the power of AI within their data management systems while ensuring high levels of customization and security. Whether you're a novice or an expert, gain actionable insights and strategies to elevate your data processes. Join us to see how FME and AI can revolutionize how you work with data!
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
perl_lessons
1. Perl Tutorial
Pablo Manalastas <pmanalastas@ateneo.edu>
LEARNING PERL
2. Numbers
● Numbers are double precision floating point
values (double in C)
3, 1.5, 2.7e8, 2_427_132_115,
0577, 0xf3ab, 0b1110001011
● Numeric operations
Add (+), subtract (), negate (), multiply (*),
divide (/), modulus (%)
3 + 4.2, 2.3e4*6.2523, 10%4
3. Strings
● Can be any length & can contain any characters
● Singlequoted strings
'Pablo de Gracia, Jr.'
'The winter of our discontent.'
'Queen's Jewels'
# the single quote ' is specified as '
'The backslash is special'
# the backslash is specified as
4. Strings
● Doublequoted strings
”against earth's flowing breast”
“I am called ”handsome” by some”
“I came.nI saw.nI conquered.n”
“Tabtseparatedtentriesthere”
● String concatenation
“Hello ” . “worldn”
● String repetition
“maganda ” x 3
5. Autoconversion: Numbers & Strings
● Arithmetic operations (+,,*,/,%) convert strings
to numbers
“12plus2” + “3” # gives the number 15
● String operation (.) converts numbers to strings
“XJW” . 24*5 # gives the string “XJW120”
6. Variables
● Variable names
[$@%][AZaz_][09AZaz_]*
● Scalar variables, name starts with $
– Holds one value (scalar value)
– Examples:
$daily_rate = 350.00;
$horse_name = “Heaven's Pride”;
$monthly_pay = $daily_rate * 22;
8. Output Using “print”
● Write output to stdout using print
print “Hello, world!n”;
print “The answer is ” . 350 * 6 .
“n”;
print “The answer is ”, 350 * 6,
“n”;
9. Interpolation
● Interpolation: the replacement of a scalar
variable by its value in a double quoted string or
when occuring alone
● Examples
$meal = 'beef steak';
print “Juan ate $mealn”;
print “I like $meal for dinnern”;
print “Juan's dinner is “ . $meal;
print “Juan's dinner is “, $meal;
10. Delimiting the Variable Name
● Use { } to delimit the variable name to be
interpolated
● Examples
$what = 'steak';
print “I love all kinds of ${what}sn”;
print “I love all kinds of $what”, “sn”;
print “Prime rib is the $what of ${what}sn”;
12. Boolean Values
● undef, number zero (0), string zero ('0'), the
empty string (''), are all false. Undef designates
a variable with no value assigned yet.
● nonzero numbers (like 1) and nonempty
strings (except '0') are all true.
● Examples
$bool1 = 'Fred' lt 'fred';
$bool2 = 'fred' lt 'Fred';
print $bool1; # prints 1 for true
print $bool2; # empty string for false
13. If Control Structure
● Syntax
if( condition ) { truepart; } else { falsepart; }
● Example
$disc = $b*$b – 4.0*$a*$c;
if( $disc >= 0.0 ) {
print “Real rootsn”;
} else {
print “Complex rootsn”;
}
14. Reading One Line from Stdin
● Use <STDIN> to read one line from standard
input, usually the console keyboard
● Examples:
print “Enter first name: “;
$fname = <STDIN>;
print “Enter last name: “;
$lname = <STDIN>;
chomp($fname);
chomp($lname);
print “Your name: $fname $lnamen”;
15. The chomp() Function
● chomp() removes a trailing newline 'n' from the
string value of a variable
● Version2 of program:
print “Enter first name: “;
chomp($fname = <STDIN>);
print “Enter last name: “;
chomp($lname = <STDIN>);
print “Your name: $fname $lnamen”;
16. While Control Structure
● Syntax:
initialization;
while ( condition ) {
statements;
reinitialization;
}
● Example:
$i = 1;
while($i <= 10) {
print “Counting $in”;
++$i;
}
17. UNDEF
● If an undefined variable is used as a number,
undef is like zero (0). If used as a string, undef
is like the empty string ('')
● If $x is undefined, the following are allowed:
$x += 2;
$x .= 'bye';
● If $x has a value, then
$x = undef;
makes $x undefined
18. The defined() Function
● The <STDIN> operation may return the value
undef when there is no more input, such as at
endoffile
● The function defined() can test if <STDIN> read
one line of input from standard input.
● Example
while(defined($line = <STDIN>)) {
print “You typed: $line”;
}
print “No more inputn”;
19. Exercises
● Write a Perl program that reads lines of input
from <STDIN>, and prints each line read. Stop
when the line that is read is 'Done' (without the
quotes).
● Write a Perl program that reads the values of
three variables $num1, $oper, and $num2 from
<STDIN>. If the value of $oper is one of the
strings 'plus', 'minus', 'times', or 'over', the
program should carry out the indicated
operation on $num1 and $num2.
20. Lists & Arrays
● List: an ordered collection of scalar values. The
index is the position of a scalar value in the list.
The index runs from 0 to (n1), where n is the
size of the list. An array is a variable that
contains a list, and starts with a @sign
● Example:
@quals
@friends
21. Initializing Arrays with Literal Values
● An array may be initialized with values in
parentheses ( ). Example:
@propty = ('Pablo', 62, 'male',
undef);
Here, the array is @propty, and the values in
the list are:
$propty[0] is 'Pablo'
$propty[1] is 62
$propty[2] is 'male'
$propty[3] is undef #civil status
22. Values May All Be Same Type
● All list values may be the same type
@friends = ('Pablo', 'Jose',
'Juan', 'Mario', 'David');
Here, the array is @friends, and the values in
the list are:
$friends[0] is 'Pablo'
$friends[1] is 'Jose'
$friends[2] is 'Juan'
$friends[3] is 'Mario'
$friends[4] is 'David'
23. Values of Array Indices
● Any value, variable, or expression, whose value is
integer or can be converted to integer can be used as
index.
● Example:
$ndx = 2.5;
$friends[$ndx+1] is $friends[3]
● $#friends is the value of the last index of array
@friends, which is 4.
● $friends[$#friends+10] = 'Carlos';
adds element 'Carlos' at index 14, the 15th element.
Values at index 5 to 13 will be undef.
24. Initializing Array with Literal Values
● @arr = ( );
@arr = (5..10, 17, 21);
@arr = ($a..$b);
@arr = qw/ Pablo Jose Mario /;
@arr = qw! Pablo Jose Mario !;
@arr = qw( Pablo Jose Mario );
@arr = qw{ Pablo Jose Mario };
@arr = qw< Pablo Jose Mario >;
25. Interpolate Arrays/Values in Strings
● If @arr is an array, then array @arr and list
value $arr[k] will be interpolated (evaluated)
when placed inside double quoted strings
● Example interpolating arrays
@arr = (5..7);
print “Four @arr eightn”;
# will print Four 5 6 7 eight
● Example interpolating list values
@toy = ('toycar', 'toyrobot',
'toygun');
print “I have a $toy[2] at homen”;
26. pop( ) Function
● pop() removes the rightmost list value from an
array
● Example:
@stk = (5..9);
$a = pop(@stk);
# remove 9 leaving 5..8, $a = 9
$b = pop @stk;
# remove 8 leaving 5..7, $b = 8
pop @stk; # remove 7 leaving 5..6
27. push() Function
● push(): adds new rightmost values to the list of
an array
● Example:
@stk = (5..8);
push(@stk, 0); # now (5,6,7,8,0)
push @stk, (1..3);# now (5,6,7,8,0,1,2,3)
@stk2 = qw/ 10 11 12 /;
push @stk, @stk2;
# now (5,6,7,8,0,1,2,3,10,11,12)
28. shift() and unshift()
● shift() is like pushing new first values, unshift()
is like popping the first value. These operations
are done on the leftmost end of the array.
● @stk = (5..9);
shift(@stk, 4); # now (4..9)
shift @stk, (1..3); # now (1..9)
$a = unshift @stk;
# remove 1 leaving (2..9), $a = 1
29. foreach Control Structure
● Syntax: foreach $var (@arr) { body; }
● Example: form the pural form of each fruit:
@fruits = qw/mango banana durian/;
foreach $fr (@fruits) {
$fr .= 's';
}
print “@fruitsn”;
30. Perl's Default Variable: $_
● If you omit $var in a foreach loop, you can refer
to this variable using $_
foreach (1..10) {
$sum += $_;
}
print “Total of 1..10 is $sumn”;
● If you omit $var in a print statement, the value of
$_ will be printed.
$_ = “Today is Saturdayn”;
print;
31. reverse() and sort()
● reverse(@arr) reverses the order of values in
the list
@fruits = qw/mango papaya chico/;
@revfr = reverse(@fruits);
@fruits = reverse(@fruits);
● sort(@arr) sorts the values in the list in
increasing lexicographic order, or string order,
not numeric order
@fruits = qw/mango papaya chico/;
@sfruits = sort(@fruits);
@rfruits = reverse sort @fruits;
32. Forcing scalar() Context
● If you want to use an array @arr in a scalar
context (for example, get the number of
elements in the list), use the function scalar()
@fruits = qw/mango banana orange/;
print “Favorite fruits: @fruitsn“;
print “My favorite fruits are “,
scalar(@fruits), “ in alln”;
33. <STDIN> as List or Scalar
● $line = <STDIN>;
reads one line from <STDIN>
● @lines = <STDIN>;
reads the entire file <STDIN> until endoffile
and assigns each line as an element of the
array @lines. If file is big, @lines may use up a
huge amount of memory. The endoffile of
<STDIN> is indicated by typing ControlD in
Unix.
35. Exercises
● Write a program that reads from <STDIN> a set
of numeric values, one per line, and computes
the mean and variance of these values. If N is
the number of values, then
mean = (sum of all values) / N;
variance =
(sum square(each value – mean)) / N;
● Write a program that reads lines from <STDIN>,
sorts these lines in reverse alphabetical order,
prints the lines, and prints the total number of
lines.
36. Hashes
● A hash is a list of keyvalue pairs. The variable
name starts with %
%age = (“Pablo”, 62, “Karen”, 23,
“Paul”, 33);
Here the key “Pablo” has value 62, the key
“Karen” has value 23, and the key “Paul” has
value 33.
● Accessing a hash by key
$age{“Paul”} gives 33
$age{“Karen”} gives 23
38. Using a Hash
● %lname = (“Pablo”=>”Manalastas”,
“Rojo”=>”Sanchez”,
“Joy”=>”Fernando”);
print “Enter first name: “;
chomp($fname = <STDIN>);
print “Last name of $fname is “,
$lname{$fname}, “n”;
39. Keys & Values
● %month = (1=>”January”,
2=>”February”,
3=>”March”, 4=>”April”, 5=>”May”);
● @k = keys %month;
# @k is the array of keys only
● @v = values %month;
# @v is the array of values only
40. each() & exists()
● %month = (1=>”January”,
2=>”February”,
3=>”March”, 4=>”April”, 5=>”May”);
● To access each (key,value) pair:
while(($key,$val) = each %month) {
print “$key => $valn”;
}
● To check if a value exists for a key
If( exists $month{13}) {
print “That is $month{13}n”;
}
41. Hash Element Interpolation
● %month = (1=>”January”,
2=>”February”,
3=>”March”, 4=>”April”, 5=>”May”);
● Can interpolate each element
print “First month is $month{1}n”;
● Not allowed
print “The months are: %monthn”;
42. Exercises
● Write a program that reads a series of words
(with one word per line) until endofinput, then
prints a summary of how many times each word
was seen.
● Write a program that prompts for month number
(112), day number (131), and year (1900
2008), and display the inputs in the form
“MonthName day, year” (without the quotes).
43. Subroutines
● Userdefined functions that allow the
programmer to reuse the same code many
times in his program
● Subroutine name starts with &, in general
● Defining a subroutine
sub subName {
subBody;
}
44. Example Function
● Defining a function:
sub greet {
print “Hello!n”;
}
● Using the function:
&greet;
45. Passing Arguments
● If the subroutine invocation is followed by a list within
parenthesis, the list is assigned to special variable @_
within the function
● Example
&greet(“Pablo”, “Jose”, “Maria”);
You can use the arguments as follows:
sub greet {
for each $name in (@_) {
print “Hello $name!n”:
}
}
47. Exercises
● Write a function that returns the product of its
arguments
● Write a function that accepts two arguments n
and d, returns a list of two numbers q and r,
where q is the quotient of n and d, and r is their
remainder
● Write a function that, given any number n as
argument, prints the value of that number in
words, as in a checkwriter.