Perl: pattern


The second split syntax is used in the Simple split example in Perl: split (split /!/, $inst_path). /PATTERN/ refers to a pattern that delimits the text. Patterns can be quite complex. For information /PATTERN/, consult Perl documentation.
 In the Simple split example in Perl: split, the pattern /!/ returns four new variables--one for each element in the string delimited by '!'. Use the four elements as command line parameters to a program (or even another Perl script!). The following is the full example.

Pattern example

$inst_path = $QPASA_VARS[0]->{path};
$value = $QPASA_VARS[0]->{value};
($host_name, $qmgr_name, $queue_name, $attr_name) = split /!/, $inst_path ;
$output = "write_to_file.pl $host_name $qmgr_name $queue_name $attr_name ";
$output .= "$value ";
$QPASA_OUTPUT = $output;
 

This example creates the following output.

 write_to_file.pl FARGO FARGO INVENTORY CurrentQDepth 506

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*