Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: Feed ARGV into one-liner

by fod (Friar)
on Jan 22, 2010 at 09:59 UTC ( #818934=note: print w/replies, xml ) Need Help??


in reply to Re: Feed ARGV into one-liner
in thread Feed ARGV into one-liner

Can you explain this please? In particular what does B';$'F=shift do? It's melting my head.... thanks

Replies are listed 'Best First'.
Re^3: Feed ARGV into one-liner
by ikegami (Pope) on Jan 22, 2010 at 10:25 UTC
    Shell literal
    -MB';$'F=shift
    produces the arg
    -MB;$F=shift
    You're probably familiar with -M. It used to load a module. It does so by inserting
    use MODULENAME;
    into the source. In this case, MODULENAME is B;$F=shift, so
    use B;$F=shift;
    is inserted into the source. B is a core module. It's not being used at all by the program. The only purpose to load it is to execute $F=shift; before the -n loop with very few keystrokes. The following would also work; it's just not nearly as short:
    '-MData::Dumper; $F=shift'
      Ah very clever. Very... lateral

      Thank you

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://818934]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (9)
As of 2018-06-18 21:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?



    Results (110 votes). Check out past polls.

    Notices?