The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

TITLE

variables - List the variables in a chunk of Perl

SYNOPSIS

 variables eg/variables
 variables 'qr/foo$bar/smx'
 variables -help
 variables -version

OPTIONS

-help

This option displays the documentation for this script. The script then exits.

-version

This option displays the version of this script. The script then exits.

DETAILS

This Perl script lists the variables in the chunk of Perl specified as the only command argument. This can be either the name of a file or literal Perl code; the choice is a pragmatic one based on whether a file by the given name actually exists.

The output is in alphabetical order by variable name, and within variable name by sigil. In the case of subscripted variables, the sigil displayed will be that of the underlying variable. That is, if $foo[0] appears, @foo will be displayed.

This script will find variables appearing in the code, and variables interpolated into strings. If PPIx::Regexp can be loaded, variables interpolated into regular expressions will also be found.

The heavy lifting is done by PPIx::QuoteLike::Utils subroutine __variables().

NOTE that the __variables() subroutine is discouraged, and may be deprecated and removed.

AUTHOR

Thomas R. Wyant, III wyant at cpan dot org

COPYRIGHT AND LICENSE

Copyright (C) 2019-2020 by Thomas R. Wyant, III

This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5.10.0. For more details, see the full text of the licenses in the directory LICENSES.

This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.