So, it seems my task can't be solved by using follow construction$ perl -MDevel::Peek -e "\$_='qwerty';Dump(\$_);s/[rt]/Dump(\$_);/ge; +print Dump(\$_)" SV = PV(0x801838) at 0x82fde0 REFCNT = 1 FLAGS = (POK,pPOK) PV = 0x201fe0 "qwerty"\0 CUR = 6 LEN = 8 SV = PVMG(0x823514) at 0x82fde0 REFCNT = 1 FLAGS = (SMG,POK,pPOK) IV = 0 NV = 0 PV = 0x201fe0 "qwerty"\0 CUR = 6 LEN = 8 MAGIC = 0x2018d0 MG_VIRTUAL = &PL_vtbl_mglob MG_TYPE = PERL_MAGIC_regex_global(g) MG_LEN = 3 SV = PVMG(0x823514) at 0x82fde0 REFCNT = 1 FLAGS = (SMG,POK,pPOK) IV = 0 NV = 0 PV = 0x201fe0 "qwerty"\0 CUR = 6 LEN = 8 MAGIC = 0x2018d0 MG_VIRTUAL = &PL_vtbl_mglob MG_TYPE = PERL_MAGIC_regex_global(g) MG_LEN = 4 SV = PVMG(0x823514) at 0x82fde0 REFCNT = 1 FLAGS = (SMG,POK,pPOK) IV = 0 NV = 0 PV = 0x2010d0 "qwey"\0 CUR = 4 LEN = 8 MAGIC = 0x2018d0 MG_VIRTUAL = &PL_vtbl_mglob MG_TYPE = PERL_MAGIC_regex_global(g) MG_LEN = -1
(Note: escaping of $ simbol is nessesary for bash$data =~s/([^\n]{16})/pos($data)=0;ch($1)/ge;
)# perl -e "\$_='qwerty';s/r/print pos();/e;" 3 BUT # perl -e "$_='qwerty';s/r/print pos();/e;" syntax error at -e line 1, near ";=" Execution of -e aborted due to compilation errors. # uname -v Darwin Kernel Version 10.4.0: Fri Apr 23 18:28:53 PDT 2010; root:xnu-1 +504.7.4~1/RELEASE_I386
In reply to Re^8: Using pos() inside regexp (no /e)
by braveghost
in thread Using pos() inside regexp
by braveghost
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |