From 326a01a6bd43cb50b29ed49f9f08c6cbb6ff3be3 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Mon, 23 Aug 2021 21:17:49 +0200 Subject: Remove incdec.pl I created this file for testing. We no longer need it. --- incdec.pl | 56 -------------------------------------------------------- 1 file changed, 56 deletions(-) delete mode 100755 incdec.pl diff --git a/incdec.pl b/incdec.pl deleted file mode 100755 index e60922e..0000000 --- a/incdec.pl +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env perl -s -# -use strict; -use warnings; - -sub incdec { - my ($line, $increment_by, $point_position, $is_backward) = @_; - - $point_position ||= 0; - $is_backward ||= 0; - - my $start_position = 0; - my $previous_match_start = 0; - while ($line =~ /\b(-?\d+)\b/g) { - if ($is_backward) { - if ($point_position < $-[0]) { - $start_position = $previous_match_start; - - last; - } - - $previous_match_start = $-[0]; - } - else { - if ($point_position < $+[0]) { - $start_position = $-[0]; - - last; - } - } - } - - if ($is_backward && $point_position == length $line) { - $start_position = $previous_match_start; - } - - pos($line) = $start_position; - $line =~ s/\G([^-\d]*)(-?\d+)/$1 . ($2 + $increment_by)/e; - - return $line; -} - -# my $line = 'test 1 0'; -# my ${"increment-by"} = -1; -# my ${"point-position"} = 8; -# my $backward = 1; - -my $line = 'test 1 -2'; -my $increment_by = -1; -my $point_position = 9; -my $backward = 1; - -print "$line, $increment_by, $point_position, $backward\n"; -my $output = incdec($line, $increment_by, $point_position, $backward); -print $output; -print "\n"; -- cgit v1.2.3