Home IT Linux Windows Database Network Programming Server Mobile  
           
  Home \ Programming \ Perl said method B if A judge     - Python Socket Network Programming (Programming)

- Vim copy and paste register (Linux)

- Shell generated using automated configuration script Orabbix (Database)

- Linux bash: scp: command not found the problem (Linux)

- Monitoring Linux System 7 command-line tool (Linux)

- Oracle GoldenGate Installation and Configuration Tutorial Introduction (Database)

- CentOS terminal display Chinese (Linux)

- Rails project prepared some tips small experience (Linux)

- To build a private Docker registry (Server)

- CentOS Linux firewall configuration and Close (Linux)

- C # DateTime structure common method (Programming)

- Linux, modify / etc / profile file (Linux)

- Linux memory Cache Analysis (Linux)

- RabbitMQ user roles and access control (Linux)

- Python virtual environment: Virtualenv (Linux)

- To get Java class / jar package path (Programming)

- By creating a personal technology blog Detailed GitHub (Linux)

- Port Telnet command to detect the remote host is turned on (Linux)

- Installation under Linux to deploy Java (Linux)

- How to contribute code on GitHub uploads (Linux)

 
         
  Perl said method B if A judge
     
  Add Date : 2017-09-18      
         
       
         
  Perl provides another "if A then B" representation. Modifiers can be added if the general statement that the conditional expressions on the back, such as:

some_statements if condition;

In this statement, for example, if the condition is true, then execute some_statements section. Such wording identical with the following wording:

if (condition) {
  some_statements;
}

Here are some similar usage:

expression unless condition; ## similar unless (condition) {expression};
expression while condition; ## similar while (condition) {expression};
expression until condition; ## similar until (condition) {expression};

The above statements are executed first condition, it decides whether to perform genuine expression.

Modifiers must be a simple expression, not a statement block.

Although the condition determination written on the back, but it is first run.

The other two "if A then B" representation:

this && that;

this || that;

Example:

#! / Usr / bin / perl -w
@a = (97..122);
@b = ( 'a' .. 'z');
@a == @b && print ( "They are equal \ n");
@a == @b || print ( "They are not equal \ n");

Logic procedures are as follows:
Table @a equal list @b, the front part of the third statement is true, the statement following && continue output "They are equal"; fourth statement, because the front is true, the statement following the || is not executed.
Table @a is not equal to the list @b, the front part of the third statement is false, it is no longer execute the statement following &&; fourth statement, because the front is false, so it needs to execute the statement following the output "They are not equal ";
     
         
       
         
  More:      
 
- To install MySQL 5.6 binary packages under CentOS 6.4 64bit (Database)
- Git and GitHub use of Eclipse and Android Studio (Programming)
- When Vim create Python scripts, vim autocomplete interpreter and encoding method (Programming)
- lolcat: an output terminal rainbow effects in the Linux command-line tool (Linux)
- MySQL Installation Troubleshooting (Database)
- Figlet use (Linux)
- How to enable Software Collections (SCL) on CentOS (Server)
- C ++ casts New Standard Comments (Programming)
- Ubuntu 14.04 build Hadoop 2.5.1 standalone and pseudo-distributed environment (32-bit) (Server)
- Valgrind * not * leak check tool (Linux)
- Kubernetes cluster deployment (Server)
- Android start automatically and add and delete a desktop shortcut (Programming)
- Detailed Linux su command to switch users Mistakes (Linux)
- Solaris 10 nagios monitoring system (Linux)
- Shell commonly commands (Linux)
- Use $ BASH ENV variable to mention the right way under Linux (Linux)
- To remove those IP is prohibited Fail2ban on CentOS 6/7 (Server)
- CentOS7 installation configuration Redis-3.0.0 (Database)
- Apache site default home page settings (Server)
- Let 32 Linux / CentOS system to support more than 4G memory (Linux)
     
           
     
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.