Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Am trying to eliminate a character from an input
$output (" show interfaces terse | match $interface"); @outputlist = split /\s+/, $output; foreach my $element (@outputlist) { if ($element =~ /e-/) { $element = s/.\K.+//; push (@child_interfaces, $element); print "1.@child_interfaces\n"; }
In the above code, @outputlist will get say, xe-2/0/0.0, i want to remove the .0 from this value, it should be xe-2/0/0 . I tried with K ( to keep existing and remove values after .. Its not working. Tried few other substitution. Is there a way to remove .0
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: String removal
by Athanasius (Cardinal) on Sep 15, 2015 at 14:28 UTC | |
by Anonymous Monk on Sep 16, 2015 at 01:55 UTC | |
|
Re: String removal
by kennethk (Abbot) on Sep 15, 2015 at 14:31 UTC |