Academic Tutorials



English | French | Portugese | Dutch | Italian
Google

em linha

Home Códigos de fonte E-Livros Downloads Contatar-nos Sobre nós

HTML Tutorials
HTML Tutorial
XHTML Tutorial
CSS Tutorial
TCP/IP Tutorial
XML Tutorials
XML Tutorial
XSL Tutorial
XSLT Tutorial
DTD Tutorial
Schema Tutorial
XForms Tutorial
XSL-FO Tutorial
XML DOM Tutorial
XLink Tutorial
XQuery Tutorial
XPath Tutorial
XPointer Tutorial
RDF Tutorial
SOAP Tutorial
WSDL Tutorial
RSS Tutorial
WAP Tutorial
Web Services Tutorial
Browser Scripting
JavaScript Tutorial
VBScript Tutorial
AJAX Tutorial
DHTML Tutorial
HTML DOM Tutorial
WMLScript Tutorial
E4X Tutorial
Server Scripting
ASP Tutorial
PHP Tutorial
PERL Tutorial
SQL Tutorial
ADO Tutorial
.NET (dotnet)
Microsoft.Net
XML Web Services
ASP.Net
.Net Mobile
C# : C Sharp
ADO.NET
VB.NET
Multimedia
SVG Tutorial
Flash Tutorial
Media Tutorial
SMIL Tutorial
Web Building
Web Browsers
Web Hosting
W3C Tutorial
Web Building
Web Quality
Web Semantic
Web Careers
Java Tutorials
Java Tutorial
JSP Tutorial
Servlets Tutorial
Struts Tutorial
EJB Tutorial
JMS Tutorial
JMX Tutorial
Programming Langauges
C Tutorial
C++ Tutorial
Visual Basic Tutorial
Data Structures Using C
Soft Skills
Communication Skills
Time Management
Project Management
Team Work
Leadership Skills
Corporate Communication
Negotiation Skills


Controlar estruturas no Perl

Previous Next





O Perl é uma língua de programação iterativa em que o controle flui da primeira indicação do programa à última indicação até e a menos que algo interromper. As coisas que podem interromper o fluxo linear são chamadas filiais e estruturas condicionais do laço. O Perl oferece a dúzia tais construções, que foram descritas abaixo.


Um Block da indicação

Os blocos da indicação fornecem uma maneira agrupando indicações que necessita ser executado em conseqüência alguma expressão está sendo avaliado. São usados nas estruturas do controle que são discutidas abaixo. Os blocos da indicação são designados por um par de cintas curly.

Form: BLOCK

{
stmt_1;
stmt_2;
stmt_3;
}


The if indicação
Form: if (EXPR) BLOCK

if (expression) {
true_stmt_1;
true_stmt_2;
true_stmt_3;
}


if/else indicação
Form: if (EXPR) BLOCK else BLOCK

if (expression) {
true_stmt_1;
true_stmt_2;
true_stmt_3;
} else {
false_stmt_1;
false_stmt_2;
false_stmt_3;
}


if/elseif/else indicação
Form: if (EXPR) BLOCK elseif (EXPR) BLOCK . . . else BLOCK

if (expression_A) {
A_true_stmt_1;
A_true_stmt_2;
A_true_stmt_3;
} elseif (expression_B) {
B_true_stmt_1;
B_true_stmt_2;
B_true_stmt_3;
} else {
false_stmt_1;
false_stmt_2;
false_stmt_3;
}


the While indicação

A ETIQUETA para esta e as seguintes estruturas do controle é opcional. Além à descrição, também fornece a função nas indicações quasi-goto como último, seguinte, e redo a indicação. A prática convencional do Perl chama-se para as etiquetas que devem ser expressadas em caixa para evitar a confusão com palavras chaves ou variáveis.

Form: LABEL: while (EXPR) BLOCK

ALABEL: while (expression) {
stmt_1;
stmt_2;
stmt_3;
}


The until indicação
Form: LABEL: until (EXPR) BLOCK

ALABEL: until (expression) { # while not
stmt_1;
stmt_2;
stmt_3;
}


The for indicação
Form: LABEL: for (EXPR; EXPR; EXPR) BLOCK

ALABEL: for (initial exp; test exp; increment exp) { # e.g., ($i=1; $i<5; $i++)
stmt_1;
stmt_2;
stmt_3;
}


The foreach indicação
Form: LABEL: foreach VAR (EXPR) BLOCK

ALABEL: foreach $i (@aList) {
stmt_1;
stmt_2;
stmt_3;
}


The last Operator

last, next e redo os operadores que seguem, aplicam-se somente às estruturas do controle do laço. Fazem com que a execução da indicação salte da posição onde ocorrem a alguma outra posição, com respeito à estrutura de bloco da estrutura abrangendo do controle. Conseqüentemente, funcionam como formulários limitados da indicação goto. O último no exemplo abaixo do controle das causas a saltar de onde ocorre à primeira indicação que segue o bloco incluindo.

ALABEL: while (expression) {
stmt_1;
stmt_2;
last;
stmt_3;
}
# last jumps to here

Se a última lata ocorrer também dentro das estruturas aninhadas do controle, o salto pode ser feito à extremidade do laço exterior simplesmente adicionando uma etiqueta a esse laço e especificando a etiqueta na última indicação.

ALABEL: while (expression) {
stmt_1;
stmt_2;
BLABEL: while (expression) {
stmt_a;
stmt_b;
last ALABEL;
stmt_c;
}
stmt_3;
}
# last jumps to here


The next Operator

O "next" é similar ao último operador a não ser que essa execução salte à extremidade do bloco, mas remanesce ainda dentro do bloco, retirando rather o bloco. Conseqüentemente a iteração continua normalmente. Como com último, em seguida pode também ser usado com uma etiqueta saltar a um laço exterior.

ALABEL: while (expression) {
stmt_1;
stmt_2;
next;
stmt_3;
# next jumps to here
}


The redo operator

“Redo” o operador é muito similar ao operador seguinte a não ser que isso a execução salte ao alto do bloco sem re-evaluation da expressão do controle. Como com último, em seguida pode também ser usado com a etiqueta saltar a um laço exterior.

ALABEL: while (expression) {
# redo jumps to here
stmt_1;
stmt_2;
redo;
stmt_3;
}





Previous Next

Keywords:tutorial do Perl, certificados do Perl, Perl que programa, Perl ativo, download do Perl, Perl da amora, expressões regulares do Perl, split do Perl, disposição do Perl, página do certificado do Perl


HTML Quizes
HTML Quiz
XHTML Quiz
CSS Quiz
TCP/IP Quiz
XML Quizes
XML Quiz
XSL Quiz
XSLT Quiz
DTD Quiz
Schema Quiz
XForms Quiz
XSL-FO Quiz
XML DOM Quiz
XLink Quiz
XQuery Quiz
XPath Quiz
XPointer Quiz
RDF Quiz
SOAP Quiz
WSDL Quiz
RSS Quiz
WAP Quiz
Web Services Quiz
Browser Scripting Quizes
JavaScript Quiz
VBScript Quiz
AJAX Quiz
DHTML Quiz
HTML DOM Quiz
WMLScript Quiz
E4X Quiz
Server Scripting Quizes
ASP Quiz
PHP Quiz
PERL Quiz
SQL Quiz
ADO Quiz
.NET (dotnet) Quizes
Microsoft.Net Quiz
XML Web Services Quiz
ASP.Net Quiz
.Net Mobile Quiz
C# : C Sharp Quiz
ADO.NET Quiz
VB.NET Quiz
Multimedia Quizes
SVG Quiz
Flash Quiz
Media Quiz
SMIL Quiz
Web Building  Quizes
Web Browsers Quiz
Web Hosting Quiz
W3C Quiz
Web Building Quiz
Web Quality Quiz
Web Semantic Quiz
Web Careers Quiz
Java Quizes
Java Quiz
JSP Quiz
Servlets Quiz
Struts Quiz
EJB Quiz
JMS Quiz
JMX Quiz
Programming Langauges Quizes
C Quiz
C++ Quiz
Visual Basic Quiz
Data Structures Using C Quiz
Soft Skills Quizes
Communication Skills Quiz
Time Management Quiz
Project Management Quiz
Team Work Quiz
Leadership Skills Quiz
Corporate Communication Quiz
Negotiation Skills Quiz

Privacy Policy
Copyright © 2003-2008 Vyom Technosoft Pvt. Ltd., All Rights Reserved.