use strict; use warnings; while (){ my $var = (split)[0]; { my $eval = "for $var ('OK '){ print $var }"; local $@; eval $eval; print "$eval\n"; if ( $@ ){ print "\nEVAL ERROR: $@\n"; } } } # data (with some modifications) from https://www.perlmonks.org/?node_id=353259 __DATA__ $NOT_AVAILABLE # A NON EXISTING SPECIAL VARIABLE $_ The default or implicit variable. $a sort comparison routine variables. $b sort comparison routine variables. $1 Regexp parenthetical capture holders. $2 Regexp parenthetical capture holders. $31 # JUST TO EXAGERATE $& Last successful match (degrades performance). ${^MATCH} Similar to $& without performance penalty. Requires /p modifier. $` Prematch for last successful match string (degrades performance). ${^PREMATCH} Similar to $` without performance penalty. Requires /p modifier. $' Postmatch for last successful match string (degrades performance). ${^POSTMATCH} Similar to $' without performance penalty. Requires /p modifier. $+ Last paren match. $^N Last closed paren match (last submatch). $^R Last regexp (?{code}) result. ${^RE_DEBUG_FLAGS} Current value of regexp debugging flags. See use re 'debug'; ${^RE_TRIE_MAXBUF} Control memory allocations for RE optimizations for large alternations. ${^ENCODING} The object reference to the Encode object, used to convert the source code to Unicode. ${^OPEN} Internal use: \0 separated Input / Output layer information. ${^UNICODE} Read-only Unicode settings. ${^UTF8CACHE} State of the internal UTF-8 offset caching code. ${^UTF8LOCALE} Indicates whether UTF8 locale was detected at startup. $. Current line number (or record number) of most recent filehandle. $/ Input record separator. $| Output autoflush. 1=autoflush, 0=default. Applies to currently selected handle. $, Output field separator (lists) $\ Output record separator. $" Output list separator. (interpolated lists) $; Subscript separator. (Use a real multidimensional array instead.) $% Page number for currently selected output channel. $= Current page length. $- Number of lines left on page. $~ Format name. $^ Name of top-of-page format. $: Format line break characters $^L Form feed (default "\f"). $^A Format Accumulator $? Child error. Status code of most recent system call or pipe. $! Operating System Error. (What just went 'bang'?) $^E Extended Operating System Error (Extra error explanation). ${^CHILD_ERROR_NATIVE} Native status returned by the last pipe close, backtick (`` ) command, successful call to wait() or waitpid(), or from the system() operator. $$ Process ID $< Real user id of process. $> Effective user id of process. $( Real group id of process. $) Effective group id of process. $0 Program name. $^O Operating System name. $] Old: Version and patch number of perl interpreter. Deprecated. $^C Current value of flag associated with -c switch. $^D Current value of debugging flags $^F Maximum system file descriptor. $^I Value of the -i (inplace edit) switch. $^M Emergency Memory pool. $^P Internal variable for debugging support. $^R Last regexp (?{code}) result. $^S Exceptions being caught. (eval) $^T Base time of program start. $^V Perl version. $^W Status of -w switch ${^WARNING_BITS} Current set of warning checks enabled by use warnings; $^X Perl executable name. ${^GLOBAL_PHASE} Current phase of the Perl interpreter. $^H Internal use only: Hook into Lexical Scoping. ${^TAINT} Taint mode read-only flag. ${^WIN32_SLOPPY_STAT} If true on Windows stat() won't try to open the file.