Skip to main content
added 188 characters in body
Source Link
Stéphane Chazelas
  • 584.7k
  • 96
  • 1.1k
  • 1.7k

A simple approach here is to do:

our $i //= 28;

That is still declare it as a package global variable to work around strict but only assign 28 if not already defined.

Alternatively, with zsh's zmv:

autoload -Uz
n=28; zmv -n '(*_)<->(.png)' '$1${(l[3][0])$((n++))}'

(like for most implementations of rename, -n is for dry-run).

A simple approach here is to do:

our $i //= 28;

That is still declare it as a package global variable to work around strict but only assign 28 if not already defined.

A simple approach here is to do:

our $i //= 28;

That is still declare it as a package global variable to work around strict but only assign 28 if not already defined.

Alternatively, with zsh's zmv:

autoload -Uz
n=28; zmv -n '(*_)<->(.png)' '$1${(l[3][0])$((n++))}'

(like for most implementations of rename, -n is for dry-run).

Source Link
Stéphane Chazelas
  • 584.7k
  • 96
  • 1.1k
  • 1.7k

A simple approach here is to do:

our $i //= 28;

That is still declare it as a package global variable to work around strict but only assign 28 if not already defined.