Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Having trouble loading a hash with map

by Utilitarian (Vicar)
on May 03, 2012 at 14:38 UTC ( #968757=note: print w/replies, xml ) Need Help??


in reply to Having trouble loading a hash with map

#!/usr/bin/perl -w use strict; use Data::Dumper; { local $/; # unset the input record seperator in order to slurp the + contents of STDIN my %hash; %hash = map { chomp; $_ => '1' } split /(\s+|\W+)/, <>; } print Dumper(\%hash); # because that's how it's supposed to be used ;)
print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."

Replies are listed 'Best First'.
Re^2: Having trouble loading a hash with map
by AnomalousMonk (Canon) on May 03, 2012 at 18:58 UTC

    If the File::Slurp module is not available, I find the
        do { local $/;  <> }
    expression preferable due to narrower, thus better controlled, scoping. (In original reply, lexical  my %hash; was defined within, accessed from outside of a block.)

    >perl -wMstrict -le "use Data::Dumper; ;; my %hash = map { chomp; $_ => '1' } split /(\s+|\W+)/, do { local $/; <> }; ;; print Dumper \%hash; " new_ib1.txt | head -10 $VAR1 = { '' => '1', 'BIG' => '1', 'you' => '1', 'model' => '1', 'NOT' => '1', ',' => '1', 'understand' => '1', 'MY' => '1', '2' => '1',

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://968757]
help
Chatterbox?
[makita]: sign_types parameter in XML::Compile::WSS ::Signature Does have anybody experience how to use it?
[makita]: Need to sign more elements but all types I put in array are ignored. And is always signed only the body
[Discipulus]: no makita sorry. i see in the synopsis of the module: "WARNING: Only limited real-life experience" might be better compose a SOPW with some code example and data
[Discipulus]: ..or inspect the source code of the module
[makita]: I am doing this:
[makita]: my $sig = $wss->signature( schema => $wsdl, token => $token, sign_types=>'wsa: Action','wsa:To', 'wsu:Timestamp', 'wsa:MessageID',' SOAP-ENV:Body', signer=>DSIG_RSA_S HA1, public_key => $cert,
[Corion]: Oof, I haven't done much with signing SOAP requests. markov is usually somebody good to ask via mail ;)
[makita]: I need to create a SOAP call where are signed more types not only the body
[makita]: I am inspecting it second day :)
[makita]: Thanks

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (11)
As of 2017-03-23 08:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (285 votes). Check out past polls.