SlideShare una empresa de Scribd logo
1 de 26
Descargar para leer sin conexión
Fitxers I Directoris
Poesia del Perl
open my $me,'<',$0
    or die $!

while (<$me>) {
   chomp;
   say if length;
}

my $beyond = <$me>
    and print
        "there is $beyond me !";

close $me;
Variables Explícites
    open my $me,'<',$0
        or die $!

    while (my $line=<$me>) {
       chomp $line;
       say $line if length;
    }

    my $beyond = <$me>
        and print
            "there is $beyond me !";

    close $me;
FileHandler
●   <$filehandler>
Open
open my $filehandler,”MODE”,$filename
  or die $!;
Modes

<
>
>>
+<
Modes
< : open my $fhr,'<',”filename”
>
>>
+<
Modes
<
> : open my $fhw,'>',”filename”
>>
+<
More info
●   perldoc perlopentut
●   perldoc perlfaq5
closing


close $fh
   or die $!;
Reading
●   Readline: <>
Reading
●   Readline: <>



       while (my $line=<$fh>) {
           chomp $line;
           say "Read a line '$line'";
       }
Reading


my @contents = <$fh>;
print @contents
Writing
open my $fh_out , '>' , ”output.txt”
    or die $!;


for my $number ( 1 .. 9 ) {
    print $fh_out “$numbern”;
}


close $fh_out
    or die $!;
  special variables
●   $.
●   $/
●   $|
Directoris i Paths
opendir my $dir,”tasks/circus”;
while (my $task = readdir $dir){
    next if /^./;
    print “$taskn”;
}
­X
●   -f
●   -d
●   -r
●   -z
●   perldoc -f -r
rename
●   rename OLDNAME,NEWNAME
    rename $oldname,$newname
       or die “No puc renombrar $oldname a $newname”
copy and move
●   use File::Copy
unlink
unlink $filename
   or die “No puc esborrar $filename. $!”;
chdir
chdir $directori
   or die “No puc anar a $directori. $!”;
Executar codi

open my $fh, ”-|” , ”ls” or die $!;
while (<$fh>) {
    print;
}
close $fh
Executar codi

open my $spam,'|-'
        ,'mailx -s “assumpte” algu@domini.edu'
    or die $!;
for my $lletra ( a .. z ) {
    print $spam “$lletran”;
}
close $spam;
close $show;
close $show or die $!;

Más contenido relacionado

La actualidad más candente

The Magic Of Tie
The Magic Of TieThe Magic Of Tie
The Magic Of Tiebrian d foy
 
Node.js - Demnächst auf einem Server in Ihrer Nähe
Node.js - Demnächst auf einem Server in Ihrer NäheNode.js - Demnächst auf einem Server in Ihrer Nähe
Node.js - Demnächst auf einem Server in Ihrer NäheRalph Winzinger
 
Not Really PHP by the book
Not Really PHP by the bookNot Really PHP by the book
Not Really PHP by the bookRyan Kilfedder
 
Up.Php
Up.PhpUp.Php
Up.Phpwsoom
 
Pemrograman Web 9 - Input Form DB dan Session
Pemrograman Web 9 - Input Form DB dan SessionPemrograman Web 9 - Input Form DB dan Session
Pemrograman Web 9 - Input Form DB dan SessionNur Fadli Utomo
 
[PyConTW 2013] Write Sublime Text 2 Packages with Python
[PyConTW 2013] Write Sublime Text 2 Packages with Python[PyConTW 2013] Write Sublime Text 2 Packages with Python
[PyConTW 2013] Write Sublime Text 2 Packages with PythonJenny Liang
 
COMP2021 Final Project - LightHTML
COMP2021 Final Project - LightHTMLCOMP2021 Final Project - LightHTML
COMP2021 Final Project - LightHTMLConrad Lo
 
[Php] navigations
[Php] navigations[Php] navigations
[Php] navigationsThai Pham
 
Total World Domination with i18n (es)
Total World Domination with i18n (es)Total World Domination with i18n (es)
Total World Domination with i18n (es)Zé Fontainhas
 
Pemrograman Web 8 - MySQL
Pemrograman Web 8 - MySQLPemrograman Web 8 - MySQL
Pemrograman Web 8 - MySQLNur Fadli Utomo
 
Threading
ThreadingThreading
Threadingb290572
 
Coding Horrors
Coding HorrorsCoding Horrors
Coding HorrorsMark Baker
 

La actualidad más candente (20)

Password.php
Password.phpPassword.php
Password.php
 
The Magic Of Tie
The Magic Of TieThe Magic Of Tie
The Magic Of Tie
 
My shell
My shellMy shell
My shell
 
Dades i operadors
Dades i operadorsDades i operadors
Dades i operadors
 
Php
PhpPhp
Php
 
Node.js - Demnächst auf einem Server in Ihrer Nähe
Node.js - Demnächst auf einem Server in Ihrer NäheNode.js - Demnächst auf einem Server in Ihrer Nähe
Node.js - Demnächst auf einem Server in Ihrer Nähe
 
Not Really PHP by the book
Not Really PHP by the bookNot Really PHP by the book
Not Really PHP by the book
 
Up.Php
Up.PhpUp.Php
Up.Php
 
Pemrograman Web 9 - Input Form DB dan Session
Pemrograman Web 9 - Input Form DB dan SessionPemrograman Web 9 - Input Form DB dan Session
Pemrograman Web 9 - Input Form DB dan Session
 
Php modul-2
Php modul-2Php modul-2
Php modul-2
 
[Php] navigations
[Php] navigations[Php] navigations
[Php] navigations
 
[PyConTW 2013] Write Sublime Text 2 Packages with Python
[PyConTW 2013] Write Sublime Text 2 Packages with Python[PyConTW 2013] Write Sublime Text 2 Packages with Python
[PyConTW 2013] Write Sublime Text 2 Packages with Python
 
COMP2021 Final Project - LightHTML
COMP2021 Final Project - LightHTMLCOMP2021 Final Project - LightHTML
COMP2021 Final Project - LightHTML
 
[Php] navigations
[Php] navigations[Php] navigations
[Php] navigations
 
Total World Domination with i18n (es)
Total World Domination with i18n (es)Total World Domination with i18n (es)
Total World Domination with i18n (es)
 
Php talk
Php talkPhp talk
Php talk
 
Pemrograman Web 8 - MySQL
Pemrograman Web 8 - MySQLPemrograman Web 8 - MySQL
Pemrograman Web 8 - MySQL
 
Threading
ThreadingThreading
Threading
 
Codigos
CodigosCodigos
Codigos
 
Coding Horrors
Coding HorrorsCoding Horrors
Coding Horrors
 

Destacado

Инструменты анализа первичной статистики социальных сетей
Инструменты анализа первичной статистики социальных сетейИнструменты анализа первичной статистики социальных сетей
Инструменты анализа первичной статистики социальных сетейГеоргий Мамарин
 
2011年度・国際経営論・トピック1
2011年度・国際経営論・トピック12011年度・国際経営論・トピック1
2011年度・国際経営論・トピック1Nozomi Soshizaki
 
20 заповедей пользователя Facebook
20 заповедей пользователя Facebook20 заповедей пользователя Facebook
20 заповедей пользователя FacebookГеоргий Мамарин
 
Социальные сети и блоги. Право на контент: Введение
Социальные сети и блоги. Право на контент: ВведениеСоциальные сети и блоги. Право на контент: Введение
Социальные сети и блоги. Право на контент: ВведениеГеоргий Мамарин
 
Социальные сети и блоги. Этика и академический троллинг
Социальные сети и блоги. Этика и академический троллингСоциальные сети и блоги. Этика и академический троллинг
Социальные сети и блоги. Этика и академический троллингГеоргий Мамарин
 
Социальные сети и блоги. Типология авторства, контент и искусство заголовка
Социальные сети и блоги. Типология авторства, контент и искусство заголовкаСоциальные сети и блоги. Типология авторства, контент и искусство заголовка
Социальные сети и блоги. Типология авторства, контент и искусство заголовкаГеоргий Мамарин
 
Социальные сети и блоги. Цифры и смыслы
Социальные сети и блоги. Цифры и смыслыСоциальные сети и блоги. Цифры и смыслы
Социальные сети и блоги. Цифры и смыслыГеоргий Мамарин
 

Destacado (14)

Test
TestTest
Test
 
Reflections 1
Reflections 1Reflections 1
Reflections 1
 
LANDLIFE
LANDLIFELANDLIFE
LANDLIFE
 
110524 xct european_funding_conservation
110524  xct european_funding_conservation110524  xct european_funding_conservation
110524 xct european_funding_conservation
 
Volkswagen Fox
Volkswagen FoxVolkswagen Fox
Volkswagen Fox
 
Инструменты анализа первичной статистики социальных сетей
Инструменты анализа первичной статистики социальных сетейИнструменты анализа первичной статистики социальных сетей
Инструменты анализа первичной статистики социальных сетей
 
дадлага
дадлагададлага
дадлага
 
2011年度・国際経営論・トピック1
2011年度・国際経営論・トピック12011年度・国際経営論・トピック1
2011年度・国際経営論・トピック1
 
Toyota 3
Toyota 3Toyota 3
Toyota 3
 
20 заповедей пользователя Facebook
20 заповедей пользователя Facebook20 заповедей пользователя Facebook
20 заповедей пользователя Facebook
 
Социальные сети и блоги. Право на контент: Введение
Социальные сети и блоги. Право на контент: ВведениеСоциальные сети и блоги. Право на контент: Введение
Социальные сети и блоги. Право на контент: Введение
 
Социальные сети и блоги. Этика и академический троллинг
Социальные сети и блоги. Этика и академический троллингСоциальные сети и блоги. Этика и академический троллинг
Социальные сети и блоги. Этика и академический троллинг
 
Социальные сети и блоги. Типология авторства, контент и искусство заголовка
Социальные сети и блоги. Типология авторства, контент и искусство заголовкаСоциальные сети и блоги. Типология авторства, контент и искусство заголовка
Социальные сети и блоги. Типология авторства, контент и искусство заголовка
 
Социальные сети и блоги. Цифры и смыслы
Социальные сети и блоги. Цифры и смыслыСоциальные сети и блоги. Цифры и смыслы
Социальные сети и блоги. Цифры и смыслы
 

Similar a Perl Fitxers i Directoris (20)

What's New in Perl? v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16What's New in Perl?  v5.10 - v5.16
What's New in Perl? v5.10 - v5.16
 
Perl Bag of Tricks - Baltimore Perl mongers
Perl Bag of Tricks  -  Baltimore Perl mongersPerl Bag of Tricks  -  Baltimore Perl mongers
Perl Bag of Tricks - Baltimore Perl mongers
 
IO Streams, Files and Directories
IO Streams, Files and DirectoriesIO Streams, Files and Directories
IO Streams, Files and Directories
 
Bash Scripting Workshop
Bash Scripting WorkshopBash Scripting Workshop
Bash Scripting Workshop
 
Perl Scripting
Perl ScriptingPerl Scripting
Perl Scripting
 
Subroutines
SubroutinesSubroutines
Subroutines
 
Bag of tricks
Bag of tricksBag of tricks
Bag of tricks
 
Learning Perl 6
Learning Perl 6 Learning Perl 6
Learning Perl 6
 
Good Evils In Perl (Yapc Asia)
Good Evils In Perl (Yapc Asia)Good Evils In Perl (Yapc Asia)
Good Evils In Perl (Yapc Asia)
 
perl-pocket
perl-pocketperl-pocket
perl-pocket
 
perl-pocket
perl-pocketperl-pocket
perl-pocket
 
perl-pocket
perl-pocketperl-pocket
perl-pocket
 
perl-pocket
perl-pocketperl-pocket
perl-pocket
 
Descobrindo a linguagem Perl
Descobrindo a linguagem PerlDescobrindo a linguagem Perl
Descobrindo a linguagem Perl
 
Perl Basics for Pentesters Part 1
Perl Basics for Pentesters Part 1Perl Basics for Pentesters Part 1
Perl Basics for Pentesters Part 1
 
Files
FilesFiles
Files
 
Files
FilesFiles
Files
 
php file uploading
php file uploadingphp file uploading
php file uploading
 
Learning Perl 6 (NPW 2007)
Learning Perl 6 (NPW 2007)Learning Perl 6 (NPW 2007)
Learning Perl 6 (NPW 2007)
 
Perl basics for Pentesters
Perl basics for PentestersPerl basics for Pentesters
Perl basics for Pentesters
 

Último

DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Visualising and forecasting stocks using Dash
Visualising and forecasting stocks using DashVisualising and forecasting stocks using Dash
Visualising and forecasting stocks using Dashnarutouzumaki53779
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 

Último (20)

DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Visualising and forecasting stocks using Dash
Visualising and forecasting stocks using DashVisualising and forecasting stocks using Dash
Visualising and forecasting stocks using Dash
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 

Perl Fitxers i Directoris