4 Einträge, 1 Seite |
1
2
3
4
@array = qw("User1 PS1 10.10.1.1","User2 PS2 10.10.1.2","User3 PS3 20.20.1.1","User4 PS4 20.20.1.2");
($ip[0] = $array[0]) =~ s/User1 PS1 (.+)/$1/;
($ip[1] = $array[3]) =~ s/User4 PS4 (.+)/$1/;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/perl
use strict;
use warnings;
my @selection = qw/User1 User4/;
my $reg = join '|',@selection;
my @array = (
'User1 PS1 10.10.10.1',
'User2 PS2 10.10.10.2',
'User3 PS3 10.10.10.3',
'User4 PS4 10.10.10.4',
);
my @ip = map { (split /\s+/)[-1] } grep(/^(?:$reg)/,@array);
local $, = "|\n";
print @ip;
4 Einträge, 1 Seite |