Skip to main content
added 3 characters in body
Source Link
Gilles Quénot
  • 36.8k
  • 7
  • 76
  • 97

This is one way that use Perl tricksmain internals, without the need to use our global variable:

rename -n 'BEGIN{$main::i = 28} s/_.*/sprintf("_%03d.png", $main::i++)/e' ./*.png 

The tricksolution here is to use the fully-qualified scalar variable $main::i (same as when in package main).

This is a tricksomething to have in the toolchest.

TIMTOWTDI

This is one way that use Perl tricks internals, without the need to use our global variable:

rename -n 'BEGIN{$main::i = 28} s/_.*/sprintf("_%03d.png", $main::i++)/e' ./*.png 

The trick here is to use the fully-qualified scalar variable $main::i (same as when in package main).

This is a trick to have in the toolchest.

This is one way that use Perl main internals, without the need to use our global variable:

rename -n 'BEGIN{$main::i = 28} s/_.*/sprintf("_%03d.png", $main::i++)/e' ./*.png 

The solution here is to use the fully-qualified scalar variable $main::i (same as when in package main).

This is something to have in the toolchest.

TIMTOWTDI

added 47 characters in body
Source Link
Gilles Quénot
  • 36.8k
  • 7
  • 76
  • 97

This is one way that use Perl tricks internals, without the need to use our global variable:

rename -n 'BEGIN{$main::i = 28} s/_.*/sprintf("_%03d.png", $main::i++)/e' ./*.png 

The trick here is to use the fully-qualified scalar variable $main::i (same as when in package main).

This is a trick to have in the toolchest.

This is one way that use Perl tricks internals:

rename -n 'BEGIN{$main::i = 28} s/_.*/sprintf("_%03d.png", $main::i++)/e' ./*.png 

The trick here is to use the fully-qualified scalar variable $main::i (same as when in package main).

This is a trick to have in the toolchest.

This is one way that use Perl tricks internals, without the need to use our global variable:

rename -n 'BEGIN{$main::i = 28} s/_.*/sprintf("_%03d.png", $main::i++)/e' ./*.png 

The trick here is to use the fully-qualified scalar variable $main::i (same as when in package main).

This is a trick to have in the toolchest.

deleted 3 characters in body
Source Link
Gilles Quénot
  • 36.8k
  • 7
  • 76
  • 97

This is one way that use internals of Perl tricks internals:

rename -n 'BEGIN{$main::i = 28} s/_.*/sprintf("_%03d.png", $main::i++)/e' ./*.png 

The trick here is to use the fully-qualified scalar variable $main::i (same as when in package main).

This is a trick to have in the toolchest.

This is one way that use internals of Perl tricks:

rename -n 'BEGIN{$main::i = 28} s/_.*/sprintf("_%03d.png", $main::i++)/e' ./*.png 

The trick here is to use the fully-qualified scalar variable $main::i (same as when in package main).

This is a trick to have in the toolchest.

This is one way that use Perl tricks internals:

rename -n 'BEGIN{$main::i = 28} s/_.*/sprintf("_%03d.png", $main::i++)/e' ./*.png 

The trick here is to use the fully-qualified scalar variable $main::i (same as when in package main).

This is a trick to have in the toolchest.

edited body
Source Link
Stéphane Chazelas
  • 587.8k
  • 96
  • 1.1k
  • 1.7k
Loading
Typo
Source Link
Gilles Quénot
  • 36.8k
  • 7
  • 76
  • 97
Loading
Post Undeleted by Gilles Quénot
Post Deleted by Gilles Quénot
Source Link
Gilles Quénot
  • 36.8k
  • 7
  • 76
  • 97
Loading