From: Wolfgang Bumiller Date: Wed, 9 Mar 2016 12:23:23 +0000 (+0100) Subject: cleanup: regex match group reference X-Git-Url: https://git.proxmox.com/?p=pve-common.git;a=commitdiff_plain;h=c4534006afde362aca59cdf07fb652bfe3f9f8c6 cleanup: regex match group reference Don't refer to the regex match group via $1 after running other code. --- diff --git a/src/PVE/Network.pm b/src/PVE/Network.pm index ac2c168..56af2ed 100644 --- a/src/PVE/Network.pm +++ b/src/PVE/Network.pm @@ -539,13 +539,13 @@ sub get_active_interfaces { while(defined(my $line = <$fh>)) { next if $line !~ /^\s*([^:\s]+):/; my $ifname = $1; - my $ifreq = pack($STRUCT_IFREQ_SIOCGIFFLAGS, $1, 0); + my $ifreq = pack($STRUCT_IFREQ_SIOCGIFFLAGS, $ifname, 0); if (!defined(ioctl($sock, SIOCGIFFLAGS, $ifreq))) { warn "failed to get interface flags for: $ifname\n"; next; } my ($name, $flags) = unpack($STRUCT_IFREQ_SIOCGIFFLAGS, $ifreq); - push @$ifaces, $1 if ($flags & IFF_UP); + push @$ifaces, $ifname if ($flags & IFF_UP); } close $fh; close $sock;