Home IT Linux Windows Database Network Programming Server Mobile  
           
  Home \ Programming \ Perl said method B if A judge     - Linux System Getting Started Tutorial: How to find the maximum memory your system supports (Linux)

- VMware installed Linux system and JDK deployment (Linux)

- Examples of Exploration Class File (Programming)

- Ubuntu uses the / etc / profile file to configure the JAVA environment variable (Linux)

- VMware difference in three network connection (Linux)

- Distributed transaction management Spring declarative transactions (Programming)

- Integrated security administrator Linux accident management (Linux)

- When a software RAID data recovery and reconstruction of how failure (Linux)

- C ++ casts New Standard Comments (Programming)

- MySQL Tutorial: About checkpoint mechanism (Database)

- Linux argument references and command substitution (Linux)

- Android Fragment really fully resolve (Programming)

- Python data types summary (Programming)

- To install file manager Nautilus 3.12.2 under ubuntu (Linux)

- Linux System Tutorial: Fix ImportError: No module named wxversion error (Linux)

- Security of data to create a safe .mdb database (Linux)

- Linux cron job (Linux)

- MongoDB relations, references, index query coverage (Database)

- Awk include binding capacity larger than the specified size of all files directory (Linux)

- Install Unity 8 preview version of the desktop in Ubuntu (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:      
 
- Oracle creates split and splitstr functions (Database)
- Java enum use (Programming)
- Install the open source database PostgreSQL 9.4 and phpMyAdmin on Ubuntu (Database)
- Oracle table space rename and delete table space (Database)
- CentOS 6 kernel upgrade to Kernel 3.x (Linux)
- C ++ constant definition (Programming)
- Debian (Wheezy) Install Redmine 2.6 (Programming)
- top command causes the system load increases (Linux)
- Swift 2.0 brief (Linux)
- IOwait Linux system monitoring diagnostic tools (Linux)
- Linux gprof oprofiling and performance testing tools (Linux)
- How to choose the correct HTTP status code (Server)
- Installation and configuration of phpMyAdmin under CentOS (Database)
- Java Cookie Comments (Programming)
- Construction CA certificate using OpenSSL command line (Server)
- Linux asynchronous read documents by AIO (Programming)
- Install Web-based monitoring tool: Linux-Dash (Server)
- Nginx start, stop, smooth start, smooth upgrade (Server)
- First start with Kali Linux 2.0 (Linux)
- CentOS 7 Add yum source (Linux)
     
           
     
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.