SlideShare a Scribd company logo
1 of 28
Pattern Matching &
File Input and Output
Contents
■ Regex
■ Regex SpecialCharacters
■ Regex Example
■ Square brackets
■ Pattern Matching & Examples
■ File I/O
■ Open a File
■ Different Methods of Files
■ Reading &Writing and Append the Files
■ Closing the Files
What is Regex.?
■ Regex is a string of text that allows you to create patterns that
help match, locate, and manage text.
■ Perl is a great example of a programming language that utilizes
regular expressions.
■ Regular Expressions can also be used from the command line
and in text editors to find text within a file.
RegexSyntax
■ Regex was most popular with perl.
■ Regex are build in to perl.
■ However almost every language use regex.
■ Systax could have minor differences from
language to language.
Regex
code
Perl
compiler
outputregex engine
RegexSyntax
■ Regular expressions are used to perform pattern-matching and
“search-and-replace” functions on text.
■ Regex syntax:-
■ /pattern/modifiers
■ Creating a regular exp:-
■ var re = /pattern/modifiers ; or var re = new RegExp(”pattern”,
”modifiers”)
■ Modifiers
■ i,g,m
Regex Special Characters
Square brackets
Pattern Matching & Examples
Step:1 create .html file
Pattern Matching & Examples
Step:2 create .pl perl file and put the cgi-bin folder.
Pattern Matching & Examples
Step:3 write all validation into the .pl file
Username validation perform
/^[A-Z]/ = Start with uppercase.
Password validation perform
/^[A-Za-z_]w{7,14}$/
Phone number validation perform
/(7|8|9)d{9}/
Pattern Matching & Examples
.html file
Step:4 Run the .html file and perform action.
.pl file
File Input and Output
What is File input and output
■ Perl to read and update the data stored within the data stream
associated with the file handle.
■ A file handle is a named internal Perl structure that associates a
physical file with a name.
■ All file handles are capable of read/write access, so you can read
from and update any file or device associated with a file handle.
■ Three basic file handles are - STDIN, STDOUT,
and STDERR, which represent standard input, standard output
and standard error devices respectively.
Opening and Closing Files
■ There are following two functions with multiple forms, which can
be used to open any new or existing file in Perl.
■ Here FILEHANDLE is the file handle returned by the open function
and EXPR is the expression having file name and mode of opening
the file.
Opening Files
■ Opening files will used to open() function.
■ Following is the syntax to open file.txt in read-only mode.
■ Here DATA is the file handle, which will be used to read the file.
Here is the example, which will open a file and will print its
content over the screen.
Opening Files
Example:-
Closing Files
■ To close a file handle, and therefore disassociate the file handle
from the corresponding file, you use the close function.
■ If no FILEHANDLE is specified, then it closes the currently
selected file handle. It returns true only if it could successfully
flush the buffers and close the file.
Different methods Files
Reading and Writing and Append Files
■ Once you have an open file handle, you need to be able to read
and write information.
■ There are a number of different ways of reading and writing data
into the file.
Reading Files
■ Consider we have a Perl file with name file.txt and has few lines
of text in it.We need to open this file and print the same.
■ $_ The default variable without parameter.
Writing Files
■ Now that you know how to open and read files learning how to
write to them is straightforward.
Appending Files
■ The above way will always try to create a file named test.txt and
writes the input into the file. we will write the same to append
the file.
Copying Files
■ Here is the example, which opens an existing file file1.txt and
read it line by line and generate another copy file file2.txt.
Renaming Files
■ Here is an example, which shows how we can rename a file
file_rename.txt to file_name.txt.
Creating Files
■ Here is an example, which shows how we can Create a file inside
a folder. If file doesn't Exists.
Deleting an Existing File
■ Here is an example, which shows how to delete a file filedel.txt
using the unlink function.
References
■ http://www.oreilly.com/openbook/cgi/ch10_03.html
■ http://www.perlmonks.org/?node_id=857049
■ https://www.tutorialspoint.com/perl/perl_files.htm
■ http://www.troubleshooters.com/codecorn/littperl/perlfile.htm
■ http://slideplayer.com/slide/download/
■ http://www.cs.unc.edu/~jbs/resources/perl/perl-basics/io.html
■ http://www.techrepublic.com/article/validating-form-input-in-
perl-with-cgivalidate/
■ https://stackoverflow.com/questions/11926599/perl-form-
validation-using-cgi-scripting
Mehul Jariwala
MCA(General) 3rd Semester
Thanks you.

More Related Content

What's hot

Python data file handling
Python data file handlingPython data file handling
Python data file handlingToniyaP1
 
Expediting MRSH-v2 Approximate Matching with Hierarchical Bloom Filter Trees
Expediting MRSH-v2 Approximate Matching with Hierarchical Bloom Filter TreesExpediting MRSH-v2 Approximate Matching with Hierarchical Bloom Filter Trees
Expediting MRSH-v2 Approximate Matching with Hierarchical Bloom Filter TreesDavid Lillis
 
Inverted files for text search engines
Inverted files for text search enginesInverted files for text search engines
Inverted files for text search enginesunyil96
 
File Types in Data Structure
File Types in Data StructureFile Types in Data Structure
File Types in Data StructureProf Ansari
 
File organization continued
File organization continuedFile organization continued
File organization continuedchesterking12
 
Indexing structure for files
Indexing structure for filesIndexing structure for files
Indexing structure for filesZainab Almugbel
 
File Organization in Database
File Organization in DatabaseFile Organization in Database
File Organization in DatabaseA. S. M. Shafi
 
File organization 1
File organization 1File organization 1
File organization 1Rupali Rana
 
Switching & Multiplexing
Switching & MultiplexingSwitching & Multiplexing
Switching & MultiplexingMelkamuEndale1
 
File management
File managementFile management
File managementsumathiv9
 
Concept of computer files
Concept of computer filesConcept of computer files
Concept of computer filesSamuel Igbanogu
 
I/O PHP Files and classes
I/O PHP Files and classesI/O PHP Files and classes
I/O PHP Files and classesSpy Seat
 
Introduction to php
Introduction  to  phpIntroduction  to  php
Introduction to phpleo paul
 

What's hot (20)

Python data file handling
Python data file handlingPython data file handling
Python data file handling
 
Inverted index
Inverted indexInverted index
Inverted index
 
Expediting MRSH-v2 Approximate Matching with Hierarchical Bloom Filter Trees
Expediting MRSH-v2 Approximate Matching with Hierarchical Bloom Filter TreesExpediting MRSH-v2 Approximate Matching with Hierarchical Bloom Filter Trees
Expediting MRSH-v2 Approximate Matching with Hierarchical Bloom Filter Trees
 
Inverted files for text search engines
Inverted files for text search enginesInverted files for text search engines
Inverted files for text search engines
 
File Types in Data Structure
File Types in Data StructureFile Types in Data Structure
File Types in Data Structure
 
File organization continued
File organization continuedFile organization continued
File organization continued
 
File organization
File organizationFile organization
File organization
 
Indexing structure for files
Indexing structure for filesIndexing structure for files
Indexing structure for files
 
File Organization in Database
File Organization in DatabaseFile Organization in Database
File Organization in Database
 
File structures
File structuresFile structures
File structures
 
File organization 1
File organization 1File organization 1
File organization 1
 
Switching & Multiplexing
Switching & MultiplexingSwitching & Multiplexing
Switching & Multiplexing
 
1
11
1
 
Indexing
IndexingIndexing
Indexing
 
File management
File managementFile management
File management
 
Concept of computer files
Concept of computer filesConcept of computer files
Concept of computer files
 
I/O PHP Files and classes
I/O PHP Files and classesI/O PHP Files and classes
I/O PHP Files and classes
 
Introduction to php
Introduction  to  phpIntroduction  to  php
Introduction to php
 
File organization
File organizationFile organization
File organization
 
Filehandling
FilehandlingFilehandling
Filehandling
 

Similar to Pattern matching & file input and output

Similar to Pattern matching & file input and output (20)

File handling and Dictionaries in python
File handling and Dictionaries in pythonFile handling and Dictionaries in python
File handling and Dictionaries in python
 
Unit V.pptx
Unit V.pptxUnit V.pptx
Unit V.pptx
 
pspp-rsk.pptx
pspp-rsk.pptxpspp-rsk.pptx
pspp-rsk.pptx
 
File handling & regular expressions in python programming
File handling & regular expressions in python programmingFile handling & regular expressions in python programming
File handling & regular expressions in python programming
 
File handling in Python
File handling in PythonFile handling in Python
File handling in Python
 
03-01-File Handling python.pptx
03-01-File Handling python.pptx03-01-File Handling python.pptx
03-01-File Handling python.pptx
 
Presentation of file handling in C language
Presentation of file handling in C languagePresentation of file handling in C language
Presentation of file handling in C language
 
File handling3 (1).pdf uhgipughserigrfiogrehpiuhnfi;reuge
File handling3 (1).pdf uhgipughserigrfiogrehpiuhnfi;reugeFile handling3 (1).pdf uhgipughserigrfiogrehpiuhnfi;reuge
File handling3 (1).pdf uhgipughserigrfiogrehpiuhnfi;reuge
 
File Handling.pptx
File Handling.pptxFile Handling.pptx
File Handling.pptx
 
Python file handling
Python file handlingPython file handling
Python file handling
 
file handling.pdf
file handling.pdffile handling.pdf
file handling.pdf
 
UNIT 5.pptx
UNIT 5.pptxUNIT 5.pptx
UNIT 5.pptx
 
Linux intro 2 basic terminal
Linux intro 2   basic terminalLinux intro 2   basic terminal
Linux intro 2 basic terminal
 
File handing in C
File handing in CFile handing in C
File handing in C
 
Working with files (concepts/pseudocode/python)
Working with files (concepts/pseudocode/python)Working with files (concepts/pseudocode/python)
Working with files (concepts/pseudocode/python)
 
Comp102 lec 11
Comp102   lec 11Comp102   lec 11
Comp102 lec 11
 
Files in Python.pptx
Files in Python.pptxFiles in Python.pptx
Files in Python.pptx
 
Files in Python.pptx
Files in Python.pptxFiles in Python.pptx
Files in Python.pptx
 
Web Development Course: PHP lecture 3
Web Development Course: PHP lecture 3Web Development Course: PHP lecture 3
Web Development Course: PHP lecture 3
 
Filing system in PHP
Filing system in PHPFiling system in PHP
Filing system in PHP
 

Recently uploaded

Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 

Recently uploaded (20)

Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 

Pattern matching & file input and output

  • 1. Pattern Matching & File Input and Output
  • 2. Contents ■ Regex ■ Regex SpecialCharacters ■ Regex Example ■ Square brackets ■ Pattern Matching & Examples ■ File I/O ■ Open a File ■ Different Methods of Files ■ Reading &Writing and Append the Files ■ Closing the Files
  • 3. What is Regex.? ■ Regex is a string of text that allows you to create patterns that help match, locate, and manage text. ■ Perl is a great example of a programming language that utilizes regular expressions. ■ Regular Expressions can also be used from the command line and in text editors to find text within a file.
  • 4. RegexSyntax ■ Regex was most popular with perl. ■ Regex are build in to perl. ■ However almost every language use regex. ■ Systax could have minor differences from language to language. Regex code Perl compiler outputregex engine
  • 5. RegexSyntax ■ Regular expressions are used to perform pattern-matching and “search-and-replace” functions on text. ■ Regex syntax:- ■ /pattern/modifiers ■ Creating a regular exp:- ■ var re = /pattern/modifiers ; or var re = new RegExp(”pattern”, ”modifiers”) ■ Modifiers ■ i,g,m
  • 8. Pattern Matching & Examples Step:1 create .html file
  • 9. Pattern Matching & Examples Step:2 create .pl perl file and put the cgi-bin folder.
  • 10. Pattern Matching & Examples Step:3 write all validation into the .pl file Username validation perform /^[A-Z]/ = Start with uppercase. Password validation perform /^[A-Za-z_]w{7,14}$/ Phone number validation perform /(7|8|9)d{9}/
  • 11. Pattern Matching & Examples .html file Step:4 Run the .html file and perform action. .pl file
  • 12. File Input and Output
  • 13. What is File input and output ■ Perl to read and update the data stored within the data stream associated with the file handle. ■ A file handle is a named internal Perl structure that associates a physical file with a name. ■ All file handles are capable of read/write access, so you can read from and update any file or device associated with a file handle. ■ Three basic file handles are - STDIN, STDOUT, and STDERR, which represent standard input, standard output and standard error devices respectively.
  • 14. Opening and Closing Files ■ There are following two functions with multiple forms, which can be used to open any new or existing file in Perl. ■ Here FILEHANDLE is the file handle returned by the open function and EXPR is the expression having file name and mode of opening the file.
  • 15. Opening Files ■ Opening files will used to open() function. ■ Following is the syntax to open file.txt in read-only mode. ■ Here DATA is the file handle, which will be used to read the file. Here is the example, which will open a file and will print its content over the screen.
  • 17. Closing Files ■ To close a file handle, and therefore disassociate the file handle from the corresponding file, you use the close function. ■ If no FILEHANDLE is specified, then it closes the currently selected file handle. It returns true only if it could successfully flush the buffers and close the file.
  • 19. Reading and Writing and Append Files ■ Once you have an open file handle, you need to be able to read and write information. ■ There are a number of different ways of reading and writing data into the file.
  • 20. Reading Files ■ Consider we have a Perl file with name file.txt and has few lines of text in it.We need to open this file and print the same. ■ $_ The default variable without parameter.
  • 21. Writing Files ■ Now that you know how to open and read files learning how to write to them is straightforward.
  • 22. Appending Files ■ The above way will always try to create a file named test.txt and writes the input into the file. we will write the same to append the file.
  • 23. Copying Files ■ Here is the example, which opens an existing file file1.txt and read it line by line and generate another copy file file2.txt.
  • 24. Renaming Files ■ Here is an example, which shows how we can rename a file file_rename.txt to file_name.txt.
  • 25. Creating Files ■ Here is an example, which shows how we can Create a file inside a folder. If file doesn't Exists.
  • 26. Deleting an Existing File ■ Here is an example, which shows how to delete a file filedel.txt using the unlink function.
  • 27. References ■ http://www.oreilly.com/openbook/cgi/ch10_03.html ■ http://www.perlmonks.org/?node_id=857049 ■ https://www.tutorialspoint.com/perl/perl_files.htm ■ http://www.troubleshooters.com/codecorn/littperl/perlfile.htm ■ http://slideplayer.com/slide/download/ ■ http://www.cs.unc.edu/~jbs/resources/perl/perl-basics/io.html ■ http://www.techrepublic.com/article/validating-form-input-in- perl-with-cgivalidate/ ■ https://stackoverflow.com/questions/11926599/perl-form- validation-using-cgi-scripting
  • 28. Mehul Jariwala MCA(General) 3rd Semester Thanks you.