Linda W schrieb am 12.01.2012 um 19:51 (-0800): > Michael Ludwig wrote: > > > >But this in a Windows batch file, it does the numbering: > > > >@ECHO OFF > >perl -e "push @l, [$.,$_] while <>; $_->[0]*=100/($#l+1) for @l; printf > >q(%%3u %%s), @$_ for @l" > > But Why doesn't this work? > > :%! perl -e 'push @l, [$.,$_] while <>; $_->[0]*=1000/$#l+1) for @l; > printf q(%%3u %% > s), @$ for @l'
Trying to achieve something meaningful by coding Perl on the command line can be frustrating, whatever the shell, or the host, because of all the escape issues. Single-quotes are preferable in Bash because they prevent $variable interpolation, but don't work in a Windows console: $ perl -lwe 'print 1' Can't find string terminator "'" anywhere before EOF at -e line 1. Use double-quotes in cmd.exe. Better yet, put your Perl in a script and then have a BAT script by the same basename to go in the same directory, which has to be in the PATH, of course. Like this: C:\bin\gurke.pl C:\bin\gurke.bat Where the BAT script is just: @perl %~dpn0.pl %* Or even, if you have a mapping for .pl in the registry: @%~n0.pl %* You can look up the funny %~ syntax in cmd.exe by saying: for /? call /? -- Michael Ludwig -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
