25 Jan 2019 14:04:05 UTC
- Distribution: App-IncrementUtils
- Source (raw)
- Browse (raw)
- How to Contribute
- Repository (git clone)
- Testers (342 / 0 / 0)
- KwaliteeBus factor: 1
- % Coverage
- License: perl_5
- Activity24 month
- Download (14.49KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest versionPERLANCAR perlancar
- COPYRIGHT AND LICENSE
inc-pl - Increment variable using Perl's auto-increment notion
This document describes version 0.001 of inc-pl (from Perl distribution App-IncrementUtils), released on 2019-01-25.
% inc-pl 1 9 01 09 a ab az A AB AZ Az aa01 aa09 aa99 2 10 02 10 b ac ba B AC BA Ba aa02 aa10 ab00
This very simple script increments its arguments using Perl's
++(auto-increment) operator. The rules, taken from perlop and copied here for convenience, are the following:
The auto-increment operator has a little extra builtin magic to it. If you increment a variable that is numeric, or that has ever been used in a numeric context, you get a normal increment. If, however, the variable has been used in only string contexts since it was set, and has a value that is not the empty string and matches the pattern "/^[a-zA-Z]*[0-9]*\z/", the increment is done as a string, preserving each character within its range, with carry: print ++($foo = "99"); # prints "100" print ++($foo = "a0"); # prints "a1" print ++($foo = "Az"); # prints "Ba" print ++($foo = "zz"); # prints "aaa" "undef" is always treated as numeric, and in particular is changed to 0 before incrementing (so that a post-increment of an undef value will return 0 rather than "undef"). The auto-decrement operator is not magical.
Specify how many times to increment.
Please visit the project's homepage at https://metacpan.org/release/App-IncrementUtils.
Source repository is at https://github.com/perlancar/perl-App-IncrementUtils.
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=App-IncrementUtils
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
This software is copyright (c) 2019 by firstname.lastname@example.org.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Module Install Instructions
To install App::IncrementUtils, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install App::IncrementUtils
For more information on module installation, please visit the detailed CPAN module installation guide.