Help for this page

Select Code to Download


  1. or download this
    my $rx = qr"^DMSC0022\s+\S+\s+(\w+)$";
    my $fmt = "Logfile_Connection_Lost Hostname: %s";
    
    ...
    if(my @match = /$rx) {
        printf "$fmt\n", @match;
    }
    
  2. or download this
    my $rx = qr"^DMSC0022\s+\S+\s+(\w+)$";
    my $fmt = "Logfile_Connection_Lost Hostname: %1";
    
    ...
        (my $msg = $fmt) =~ s/%\d+/$match[$1]/e;
        print "$msg\n";
    }