Please find the attachment.
On Thu, Dec 17, 2015 at 1:26 AM, Raj Barath wrote:
> Can you share a simple of JSON file and from that let us know what you
> want to capture.
>
> On Wed, Dec 16, 2015, 3:41 PM perl kamal wrote:
>
>> ++Subject & Thanks.
>>
>> On Thu, Dec 17, 2015 at 1:08 AM, perl kam
Can you share a simple of JSON file and from that let us know what you want to
capture.
On Wed, Dec 16, 2015, 3:41 PM perl kamal
mailto:kamal.p...@gmail.com>> wrote:
++Subject & Thanks.
On Thu, Dec 17, 2015 at 1:08 AM, perl kamal
mailto:kamal.p...@gmail.com>> wrote:
Hi,
I am trying to read a
Can you share a simple of JSON file and from that let us know what you want to
capture.
On Wed, Dec 16, 2015, 3:41 PM perl kamal
mailto:kamal.p...@gmail.com>> wrote:
++Subject & Thanks.
On Thu, Dec 17, 2015 at 1:08 AM, perl kamal
mailto:kamal.p...@gmail.com>> wrote:
Hi,
I am trying to read a
++Subject & Thanks.
On Thu, Dec 17, 2015 at 1:08 AM, perl kamal wrote:
> Hi,
>
> I am trying to read a json output file,capture the required information,
> storing them in an array and format the output in a file.
> Please review my code and suggest me is there any way to construct the
> hash da
Hi,
On 09/24/2013 12:17 AM, David Christensen wrote:
> beginners:
>
> H() is the hash function
as you want the same hash of a substring regardless of the position, I
think you cannot make the hash dependent on the position of each
character in the string. A simple solution could be to ad
On 09/25/13 18:53, Jing Yu wrote:
Another look at it, and I think I've pointed you to a wrong way. BLAST might
not what you need. Sorry about this.
No problem. The more I look at it, the less I believe there is such a
pair of functions.
David
--
To unsubscribe, e-mail: beginners-unsubscr
Hi David,
Another look at it, and I think I've pointed you to a wrong way. BLAST might
not what you need. Sorry about this.
Jing
On 25 Sep 2013, at 03:31, David Christensen wrote:
> On 09/24/13 00:12, Dr.Ruud wrote:
>> I assume this is about paths and filenames. Have you considered an rsync
>>
On 09/24/13 00:12, Dr.Ruud wrote:
I assume this is about paths and filenames. Have you considered an rsync
dry-run?
I use "rsync -n ..." frequently.
I also assume that you want to communicate as little as possible, so you
don't have supersets of all strings on all sides. (or it would become
On 24/09/2013 00:17, David Christensen wrote:
I'm looking for a hash function and a related function or operator such
that:
H(string1 . string2) = f(H(string1), H(string2))
H(string1 . string2) = H(string1) op H(string2)
where:
H() is the hash function
string1 i
On 09/23/13 18:17, Jing Yu wrote:
I don't know the answer but... it sounds like NCBI's BLAST to me, which
compares nucleotide or protein sequences. NCBI's FTP site provides local BLAST
binaries, and bioperl offers some convenient tools to implement it.
That looks like server-side software, ca
Hi David,
I don't know the answer but... it sounds like NCBI's BLAST to me, which
compares nucleotide or protein sequences. NCBI's FTP site provides local BLAST
binaries, and bioperl offers some convenient tools to implement it.
Regards,
Jing
On 24 Sep 2013, at 07:01, David Christensen wrote
On 09/23/13 15:34, someone wrote:
Er "hash function" as in crypto hashing? a does:
H(string1 . string2) = f(H(string1), H(string2))
H(string1 . string2) = H(string1) op H(string2)
mean that
I'm looking for a hash function and a related function or operator such
that:
f(H(string1), H
On 09/23/13 15:29, Rob Dixon wrote:
My immediate thought is that the only hash function that can work like
this is the identity function (or any one-one mapping) because, by
extension, the hash of a string must be equal to f(the hash of each of
its characters).
Not that I can prove this at presen
On 23/09/2013 23:17, David Christensen wrote:
beginners:
I'm looking for a hash function and a related function or operator such
that:
H(string1 . string2) = f(H(string1), H(string2))
H(string1 . string2) = H(string1) op H(string2)
Hi David
My immediate thought is that the only ha
On Apr 19, 2013, at 6:45 AM, Peter Scott wrote:
> On Wed, 17 Apr 2013 11:47:49 -0700, Jim Gibson wrote:
>> 1. You should not modify a hash while you are iterating through it with
>> the each() function. The each() function uses an internal data structure
>> that persists from one call of each to
On Wed, 17 Apr 2013 11:47:49 -0700, Jim Gibson wrote:
> 1. You should not modify a hash while you are iterating through it with
> the each() function. The each() function uses an internal data structure
> that persists from one call of each to the next. That internal data
> structure can be modifie
On 04/17/2013 02:45 PM, Andy Bach wrote:
while ( ($key2, $value2) = each %names ) {
and the better idiom is;
foreach my $key ( keys %names ) {
print "got: $key => $names{$key}\n"
}
actually IMO the while/each loop is the better (and lesser known) idiom.
it is more efficient as you don't
On 04/17/2013 02:45 PM, Andy Bach wrote:
loop:
while ( ($key2, $value2) = each %names ) {
and the better idiom is;
foreach my $key ( keys %names ) {
print "got: $key => $names{$key}\n"
}
actually IMO the while/each loop is the better (and lesser known) idiom.
it is more efficient as you
On Apr 17, 2013, at 11:17 AM, Irfan Sayed wrote:
> hi,
> need help on hashes
> here is the code :
>
>
> print "Enter the words: ";
> chomp(my @words = );
>
> my %names;
>
> foreach $a (@words) {
> if (!%names) {
> print "hi\n";
> $names{$a} = 1;
> } else {
> while ( ($key, $value) = each %na
On Wed, Apr 17, 2013 at 1:17 PM, Irfan Sayed wrote:
> please suggest
You need to work on indenting! Name a hash and an array the same is going
to lead to troubles down the road. The standard idiom for going through a
hash is to just get the key and the ref the value via the hash:
foreach my $ke
On Thu, Nov 15, 2012 at 10:06 PM, Chris Charley wrote:
>
>
> "jet speed" wrote in message news:CAG1VzcezebNiFar3YKep-
>
> What i am trying to do ?
>> I want to match the entries from file1.txt with file.txt, if matches then
>> print the key and value. some will have multiple entries as in the ou
"jet speed" wrote in message news:CAG1VzcezebNiFar3YKep-
What i am trying to do ?
I want to match the entries from file1.txt with file.txt, if matches then
print the key and value. some will have multiple entries as in the output.
required output
10.00.00.00.aa.56.9b.7a 22:5a
10.00.00.00.
"jet speed" wrote in message news:CAG1VzcezebNiFar3YKep-
What i am trying to do ?
I want to match the entries from file1.txt with file.txt, if matches then
print the key and value. some will have multiple entries as in the output.
required output
10.00.00.00.aa.56.9b.7a 22:5a
10.00.00.00.
"jet speed" wrote in message news:CAG1VzcezebNiFar3YKep-
What i am trying to do ?
I want to match the entries from file1.txt with file.txt, if matches then
print the key and value. some will have multiple entries as in the output.
required output
10.00.00.00.aa.56.9b.7a 22:5a
10.00.00.00.
On Nov 15, 2012, at 8:40 AM, jet speed wrote:
> On Thu, Nov 15, 2012 at 2:49 PM, jet speed wrote:
>
>> On Thu, Nov 15, 2012 at 11:43 AM, Charles DeRykus wrote:
>>
>> Thanks Charles,
>>
>> What i am trying to do ?
>> I want to match the entries from file1.txt with file.txt, if matches then
>>
On Thu, Nov 15, 2012 at 2:49 PM, jet speed wrote:
>
>
> On Thu, Nov 15, 2012 at 11:43 AM, Charles DeRykus wrote:
>
>> On Thu, Nov 15, 2012 at 2:46 AM, jet speed
>> > ...
>> > I was able to build the hash, however the file contains approx 10,000
>> > entries. but while i print the hash i get on
On Thu, Nov 15, 2012 at 11:43 AM, Charles DeRykus wrote:
> On Thu, Nov 15, 2012 at 2:46 AM, jet speed
> > ...
> > I was able to build the hash, however the file contains approx 10,000
> > entries. but while i print the hash i get only approx 1300 lines or
> > key=>values.
> >
> > i guess its
On Thu, Nov 15, 2012 at 2:46 AM, jet speed
> ...
> I was able to build the hash, however the file contains approx 10,000
> entries. but while i print the hash i get only approx 1300 lines or
> key=>values.
>
> i guess its because, the file has duplicate entries. example below
>
> file.txt
>>
On Thu, 15 Nov 2012 10:46:34 +
jet speed wrote:
> I was able to build the hash, however the file contains approx
> 10,000 entries. but while i print the hash i get only approx 1300
> lines or key=>values.
>
> i guess its because, the file has duplicate entries. example below
[...]
> How
On 2012-11-15 11:46, jet speed wrote:
22:5a => 10.00.00.00.aa.56.9b.7a
22:5a => 10.00.00.00.aa.57.99.8a
32:9c => 10.00.00.00.aa.46.9b.33
a2:cc => 10.00.00.00.aa.5a.9b.63
a5:cc => 10.00.00.00.aa.5a.9b.63
b2:cc => 10.00.00.00.aa.5a.9b.63
How do i build all the entries into
On Thu, Nov 15, 2012 at 8:46 AM, Dr.Ruud wrote:
> On 2012-11-15 03:07, Uri Guttman wrote:
>
> my %hash = read_file( 'file.txt' ) =~ /^(.+)\s*=>\s*(.+)$/mg ;
>>
>
> Trailing whitespace in the keys? Skipping empty values?
>
> my %kv= read_file( 'file.txt' ) =~ /^(.+?)\s*=>\s*(.*)/mg;
>
> an
On 2012-11-15 03:07, Uri Guttman wrote:
my %hash = read_file( 'file.txt' ) =~ /^(.+)\s*=>\s*(.+)$/mg ;
Trailing whitespace in the keys? Skipping empty values?
my %kv= read_file( 'file.txt' ) =~ /^(.+?)\s*=>\s*(.*)/mg;
and without File::Slurp:
my %kv= map m/(.+?)\s*=>\s*(.*)/, <$fh>
On 11/14/2012 05:45 PM, Charles DeRykus wrote:
On Wed, Nov 14, 2012 at 9:05 AM, jet speed wrote:
Hi
Is there a way, i can build an %hash from a file as Input. Appreciate you
help with this.
file.txt
22:5a => 10.00.00.00.aa.56.9b.7a
32:9c => 10.00.00.00.aa.46.9b.33
a2:cc=> 10.
On Wed, Nov 14, 2012 at 9:05 AM, jet speed wrote:
> Hi
> Is there a way, i can build an %hash from a file as Input. Appreciate you
> help with this.
>
> file.txt
>
>
> 22:5a => 10.00.00.00.aa.56.9b.7a
> 32:9c => 10.00.00.00.aa.46.9b.33
> a2:cc=> 10.00.00.00.aa.5a.9b.63
Assuming n
On 11/14/2012 12:05 PM, jet speed wrote:
Hi
Is there a way, i can build an %hash from a file as Input. Appreciate you
help with this.
file.txt
22:5a => 10.00.00.00.aa.56.9b.7a
32:9c => 10.00.00.00.aa.46.9b.33
a2:cc=> 10.00.00.00.aa.5a.9b.63
Thanks
Sj
J.S.:
Thought of two
On Wed, Nov 14, 2012 at 11:05 AM, jet speed wrote:
>
> file.txt
>
>
> 22:5a => 10.00.00.00.aa.56.9b.7a
> 32:9c => 10.00.00.00.aa.46.9b.33
> a2:cc=> 10.00.00.00.aa.5a.9b.63
Er, read it in, line by line, chomp, split on something like
my ($key, $value) = split(/\s*=>\s*/);
and b
That is the content of your file, with those ' => ' and everything?
You should describe what you want the resulting %hash to contain, using
the example file you provided.
--Brock
On 2012.11.14.17.05, jet speed wrote:
> Hi
> Is there a way, i can build an %hash from a file as Input. Appreciate yo
> IIRC, a long time ago I send you a patch for Sort::Maker benchmarking
> script incorporating Sort::Key variants that showed how faster my module
> can be. I would try to find it and send it to you again.
Well, I have been unable to find it... but I have redone it :-)
Attached are the patch tha
On 08/23/2012 09:10 AM, Uri Guttman wrote:
> On 08/23/2012 02:54 AM, Salvador Fandino wrote:
>
>>>
>>> It's a pity Sort::Maker not in Debian
>>
>> There is also Sort::Key, available in Debian testing and unstable, and
>> which is usually faster than Sort::Maker and also Sort::Key::Radix, even
>> f
On Thu, Aug 23, 2012 at 9:10 AM, Uri Guttman wrote:
> On 08/23/2012 02:54 AM, Salvador Fandino wrote:
>
>
>>> It's a pity Sort::Maker not in Debian
>>>
>>
>> There is also Sort::Key, available in Debian testing and unstable, and
>> which is usually faster than Sort::Maker and also Sort::Key::Radi
On 08/23/2012 02:54 AM, Salvador Fandino wrote:
It's a pity Sort::Maker not in Debian
There is also Sort::Key, available in Debian testing and unstable, and
which is usually faster than Sort::Maker and also Sort::Key::Radix, even
faster when sorting by numeric keys but not available in Debian
On 08/22/2012 10:34 PM, Eduardo wrote:
> On 22/08/12 03:49, Uri Guttman wrote:
>> On 08/21/2012 08:29 PM, Eduardo wrote:
>>> how would you do with Sort::Maker?
>> i don't have time to show an example now but it is much cleaner
>> looking. all you need to do is code up how you extract each key from
On 22/08/12 03:49, Uri Guttman wrote:
> On 08/21/2012 08:29 PM, Eduardo wrote:
>> how would you do with Sort::Maker?
> i don't have time to show an example now but it is much cleaner
> looking. all you need to do is code up how you extract each key from
> the data set and how it gets sorted (number
On 08/21/2012 08:29 PM, Eduardo wrote:
On 22/08/12 00:35, Uri Guttman wrote:
my %cache = ();
foreach ( keys %$hash )
{
my ( $naa, $nab ) = $_ =~ m|^(\d+)-(\d+)|;
$cache{ ($naa * 100 + $nab ) } = $_;
}
that is a variant of the orcish manoever which is supported by sort::maker.
fore
On 22/08/12 00:35, Uri Guttman wrote:
> On 08/21/2012 05:33 PM, Eduardo wrote:
>> On 21/08/12 22:05, Chris Stinemetz wrote:
>>> Hello List,
>>>
>>> I am trying to sort a hash of arrays ( example below: )
>>>
>>> I would the sort to sort in ascending order the first index of the
>>> array
>>> then
On 08/21/2012 05:33 PM, Eduardo wrote:
On 21/08/12 22:05, Chris Stinemetz wrote:
Hello List,
I am trying to sort a hash of arrays ( example below: )
I would the sort to sort in ascending order the first index of the array
then the second index of the array.
So in this example the arrays wou
On 21/08/12 22:05, Chris Stinemetz wrote:
> Hello List,
>
> I am trying to sort a hash of arrays ( example below: )
>
> I would the sort to sort in ascending order the first index of the array
> then the second index of the array.
>
> So in this example the arrays would sort to:
>
> 97,2,120,65
>
I will leave it to you to write an actual program incorporating these
> ideas.
>
> Thank you Jim for the excelent explanation.
This seems to do the trick.
foreach my $cellNo ( sort { $hash{$a}->[0] <=> $hash{$b}->[0] ||
$hash{$a}->[1] <=> $hash{$b}->[1] } keys %hash ) {
print join( "\0", @{
On Aug 21, 2012, at 1:23 PM, Jim Gibson wrote:
>
> On Aug 21, 2012, at 1:05 PM, Chris Stinemetz wrote:
>
>> Hello List,
>>
>> I am trying to sort a hash of arrays ( example below: )
>>
>> I would the sort to sort in ascending order the first index of the array
>> then the second index of the
On Aug 21, 2012, at 1:05 PM, Chris Stinemetz wrote:
> Hello List,
>
> I am trying to sort a hash of arrays ( example below: )
>
> I would the sort to sort in ascending order the first index of the array
> then the second index of the array.
I believe you mean "first element" rather than "first
On Tue, Aug 21, 2012 at 3:11 PM, Shawn H Corey wrote:
> On Tue, 21 Aug 2012 15:05:33 -0500
> Chris Stinemetz wrote:
>
> > I am trying to sort a hash of arrays ( example below: )
> >
> > I would the sort to sort in ascending order the first index of the
> > array then the second index of the array
On Tue, 21 Aug 2012 15:05:33 -0500
Chris Stinemetz wrote:
> I am trying to sort a hash of arrays ( example below: )
>
> I would the sort to sort in ascending order the first index of the
> array then the second index of the array.
What have you tried so far? Can we see the code?
--
Just my 0
On Tue, Jul 3, 2012 at 6:44 AM, Chris Stinemetz
wrote:
> On Tue, Jul 3, 2012 at 5:11 AM, xiyoulaoyuanjia
> wrote:
>> hi Rob 。 i do not know what the 'for' meaning inprint $_->[0], "\n" for
>> sort { $b->[1] <=> $a->[1] } @RNC;
>> can you give me mush information about this use 。
>> 3ks !
>>
On Tue, Jul 3, 2012 at 5:11 AM, xiyoulaoyuanjia
wrote:
> hi Rob 。 i do not know what the 'for' meaning inprint $_->[0], "\n" for
> sort { $b->[1] <=> $a->[1] } @RNC;
> can you give me mush information about this use 。
> 3ks !
>
I believe xiyoulaoyuan...@gmail.com intended to send this questi
>
> I believe you want the output lines formatted as they are but sorted in
> descending order of the ec_count value, is that right?
>
> I suggest that, instead of printing the data straight from the hash you
> store the lines in an array and sort it before displaying the information.
>
> The code
On 02/07/2012 17:42, Chris Stinemetz wrote:
I have a 3 deminsional hash that I would like to sort on the value in
descending order. I can't quite seem to figure it out
The portion of the program I can't get figured out:
## body
foreach my $frameNo ( keys %RNC ) {
foreach my $ec ( keys %{$RNC{
On Mon, 2 Jul 2012 11:42:44 -0500
Chris Stinemetz wrote:
> I have a 3 deminsional hash that I would like to sort on the value in
> descending order. I can't quite seem to figure it out
>
> The portion of the program I can't get figured out:
> ## body
> foreach my $frameNo ( keys %RNC ) {
> fore
On 17/11/2011 07:56, Stefan Wiederoder wrote:
Hello Brandon,
thanks a lot for your help - your code works like a charm, I´ve
already put in my script which is now generating puppet node/classes
definitions.
Sometimes, but very rarely, the answer to a question should include
working code. It i
Hello Brandon,
thanks a lot for your help - your code works like a charm, I´ve
already put in my script
which is now generating puppet node/classes definitions.
bye
,
Stefan
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http:/
On Tuesday, November 15, 2011 at 11:10 , Stefan Wiederoder wrote:
> Hello list,
>
> I´m using a json config file to read a file with server group
> definitions, including group of groups like
> this example:
>
> [jdoe@belbo]# cat groups.json
> {
> "G_Group_PR" : [ "serverA", "serverB" ],
> "G_G
On 11/15/11 Tue Nov 15, 2011 8:10 AM, "Stefan Wiederoder"
scribbled:
> Hello list,
>
> I´m using a json config file to read a file with server group
> definitions, including group of groups like
> this example:
>
> [jdoe@belbo]# cat groups.json
> {
> "G_Group_PR" : [ "serverA", "serve
Hello Stefan,
On Tue, Nov 15, 2011 at 08:10:12AM -0800, Stefan Wiederoder wrote:
> Hello list,
>
> I´m using a json config file to read a file with server group
> definitions, including group of groups like
> this example:
>
> [jdoe@belbo]# cat groups.json
> {
> "G_Group_PR" : [ "serverA
On Fri, 28 Oct 2011 07:23:16 -0400
John SJ Anderson wrote:
>
>
> On Friday, October 28, 2011 at 07:05 , Gary wrote:
>
> > sub new {
> > my ($class, $file_name) = @_;
> > my $self = {
> > _file_name => $file_name,
> >
> > _cfg => {} # <--<< the hash i want to access
> > };
> > bless $self, $cl
On Friday, October 28, 2011 at 07:54 , Gary wrote:
> Dermot, you're a genius! I would *never* have stumbled on that byaccident.
> I'm pretty sure I did try %$self->{_cfg} but it was having
> none of it.
>
At this point I'm going to gently but firmly recommend that you stop and read
some docum
On 28 October 2011 12:40, Gary wrote:
>> Thanks.
>
> Sh1t. How do I use this in a foreach, please?
>
> Trying
> foreach my $key (sort keys $self->{_cfg} ) {
> I get "Type of arg 1 to keys must be hash (not hash element)"
>
foreach my $key (sort keys %{ $self->{_cfg} } ) {
# do stuff
}
%{ $refe
On Friday, October 28, 2011 at 07:05 , Gary wrote:
> sub new {
> my ($class, $file_name) = @_;
> my $self = {
> _file_name => $file_name,
>
> _cfg => {} # <--<< the hash i want to access
> };
> bless $self, $class;
> return $self;
> }
>
> but I can't work out how to access self->_cfg and its e
> On Tue, Aug 23, 2011 at 10:23 AM, wrote:
> I am working on the below code to traverse through a hash, but it throws an
> error which states "Can't coerce array into hash at temp.pl line 6."
>
> Code:
> ===
> sub hash_walk {
>my
When you shift off a variable you pop it out of the argument . Just try and
get the first variable of the argument another way by copying to an array
first or something .
from perldoc
Shift :
Shifts the first value of the array off and returns it, shortening the array
by 1 and moving everything do
Thanks a lot for the suggestions and solution.
Regards,
Anand
-Original Message-
From: Shlomi Fish [mailto:shlo...@shlomifish.org]
Sent: Tuesday, August 23, 2011 5:09 PM
To: Jawaji, Anand
Cc: beginners@perl.org
Subject: Re: Hash of Hashes - Error
Hi Anand,
On Tue, 23 Aug 2011 05:57:02
Hi Anand,
On Tue, 23 Aug 2011 05:57:02 -0400
wrote:
> Hi All,
>
> I am working on the below code to traverse through a hash, but it throws an
> error which states "Can't coerce array into hash at temp.pl line 6."
>
First of all, let me note that the indentation on that code is inconsistent an
> -Original Message-
> From: anand.jaw...@emc.com [mailto:anand.jaw...@emc.com]
> Sent: Tuesday, August 23, 2011 5:57 AM
> To: beginners@perl.org
> Subject: Hash of Hashes - Error
>
> Hi All,
>
> I am working on the below code to traverse through a hash, but it
> throws an error which sta
On 16/06/2011 18:03, Grant wrote:
Depending on whether there are one or more sets of values, XML::Simple
either creates a hash or an array, either of which are stored here:
$parsed_response->{Label}->{Image}
My code retrieves the correct value when it's an array but I'm not
sure how to do the s
> "G" == Grant writes:
>> ForceArray => ['Image']
G> I tried that and it seems to behave the same as 'ForceArray => 1'.
G> Everything seems to be forced into an array.
that ForceArray should work as i have used it just like that. it will
only force arrays of the keys you pass to it
Depending on whether there are one or more sets of values, XML::Simple
either creates a hash or an array, either of which are stored here:
$parsed_response->{Label}->{Image}
My code retrieves the correct value when it's an array but I'm not
sure how to do the same
On 16/06/2011 02:15, Grant wrote:
Depending on whether there are one or more sets of values, XML::Simple
either creates a hash or an array, either of which are stored here:
$parsed_response->{Label}->{Image}
My code retrieves the correct value when it's an array but I'm not
sure how to do the s
>> Depending on whether there are one or more sets of values, XML::Simple
>> either creates a hash or an array, either of which are stored here:
>>
>> $parsed_response->{Label}->{Image}
>>
>> My code retrieves the correct value when it's an array but I'm not
>> sure how to do the same when it's a h
On 15/06/2011 18:02, Grant wrote:
Depending on whether there are one or more sets of values, XML::Simple
either creates a hash or an array, either of which are stored here:
$parsed_response->{Label}->{Image}
My code retrieves the correct value when it's an array but I'm not
sure how to do the s
On 11-04-15 12:25 AM, dbro wrote:
if (! $hash{$_} ) {
%hash = ( $_ => $count );
} else {
$hash{$_} = $hash{$_} + 1;
Use this instead:
$hash{$_} ++;
--
Just my 0.0002 million dollars worth,
Shawn
Confusion is the first step of understanding.
Programmin
From: "dbro"
> Im trying to learn hashes but having a hard time trying to figure out
> why it seems I cant use data from a hash outside of the original for
> loop. This code works as expected to me. I guess it would be the
> same if i just stuck a print statement after the hash assignment:
>
>
> "JWK" == John W Krahn writes:
JWK> Uri Guttman wrote:
>>> "sw" == shawn wilson writes:
>>
sw> my $data;
>>
sw> while ( my $line = ) {
>>
sw> chomp ($line);
sw> my @word = split / /, $line;
>>
>>
sw> my $count = 0;
sw> foreach my $aword ( @word ) {
sw>
Uri Guttman wrote:
"sw" == shawn wilson writes:
sw> my $data;
sw> while ( my $line = ) {
sw> chomp ($line);
sw> my @word = split / /, $line;
sw> my $count = 0;
sw> foreach my $aword ( @word ) {
sw> $aword =~ tr/^[
> "sw" == shawn wilson writes:
sw> 1. what's the reason for 'use warnings' instead of 'perl -w'? just
sw> readability or is there something more?
use warnings are lexical and affect only the file/scope they are in. -w
is a global flag that affect all the code. if you use a module that
is
ok, i think i understand most of the documentation you sent (well,
http://bobby-tables.com/ didn't work, but i read the rest). below is my
modified code (i'm hoping it is better than the code i posted before as that
might mean that i possibly learned something :) ).
i also have a couple questions:
Hi Shawn,
On Wednesday 03 November 2010 16:25:09 shawn wilson wrote:
> hummm, i'm still having issues with these references. i'm hoping someone
> might see some flaw in my syntax or logic that might be easily corrected.
> so, here is what i have in all it's glory. what i want for output is return
hummm, i'm still having issues with these references. i'm hoping someone
might see some flaw in my syntax or logic that might be easily corrected.
so, here is what i have in all it's glory. what i want for output is return
a csv with:
search term,string from db,lines from input search string came f
On Wed, Nov 03, 2010 at 06:03:11AM -0700, John W. Krahn wrote:
> Shlomi Fish wrote:
> >
> >2. You are trying to iterate over %{$data{$word}} in two nested loops. This
> >will confuse Perl to no end.
>
> No it will not. Perl will know exactly what to do.
Yes, perl will do exactly what it was aske
Shlomi Fish wrote:
On Wednesday 03 November 2010 09:27:14 shawn wilson wrote:
i'm getting errors when trying to print these hash refs out and i just
can't figure it out. here's the function:
for my $word ( keys %data ) {
while( my ($field, $type) = each %{ $data }{ $word } ) {
print
Hi Shawn,
On Wednesday 03 November 2010 09:27:14 shawn wilson wrote:
> i'm getting errors when trying to print these hash refs out and i just
> can't figure it out. here's the function:
>
> for my $word ( keys %data ) {
>while( my ($field, $type) = each %{ $data }{ $word } ) {
> print "
Chas. Owens wrote:
Thomas Bätzler:
#!/usr/bin/perl -w
use strict;
Don't use -w. Use the [warnings pragma][0] instead. When you say -w
you turn on warnings for everything, even modules that are not
expecting them. Read more in [perldoc perllexwarn][1].
And that is why I prefer -w.
(Mayb
On Mon, Jul 26, 2010 at 09:21, Thomas Bätzler wrote:
snip
> Assuming that $abc is a hash reference, it works like this:
>
> #!/usr/bin/perl -w
>
> use strict;
snip
Don't use -w. Use the [warnings pragma][0] instead. When you say -w
you turn on warnings for everything, even modules that are not
Thank you, Bob & others. I think I now understand better. I have the
source code. So now I should be able to figure this out.
Regards,
Sharan
On Mon, Jul 26, 2010 at 6:00 PM, Rob Coops wrote:
>
>
> On Mon, Jul 26, 2010 at 2:09 PM, Sharan Basappa
> wrote:
>>
>> Folks,
>>
>> I am reusing a code f
On Mon, Jul 26, 2010 at 08:09, Sharan Basappa wrote:
> Folks,
>
> I am reusing a code for some enhancements. According to my
> understanding, it is a record with
> some unique string as key and then hash array as the value.
>
> I iterate through the array and print as follows:
>
> foreach my $key
On Mon, Jul 26, 2010 at 2:09 PM, Sharan Basappa wrote:
> Folks,
>
> I am reusing a code for some enhancements. According to my
> understanding, it is a record with
> some unique string as key and then hash array as the value.
>
> I iterate through the array and print as follows:
>
> foreach my $ke
> "JG" == Jim Green writes:
JG> i have a question for the following perl code, by changing the value
JG> in %h3, the script also changes the value for %h4, I vaguely
JG> understand it is because %h3's key is reference to %h2, %h2's key is
JG> reference to %h1,
JG> so by changing v
Jim Green wrote:
> i have a question for the following perl code, by changing the value
> in %h3, the script also changes the value for %h4, I vaguely
> understand it is because %h3's key is reference to %h2, %h2's key is
> reference to %h1,
>
> so by changing value in %h3, the script also change
- Original Message -
From: ""Johnson, Reginald (GTS)""
Newsgroups: perl.beginners
To:
Sent: Sunday, January 17, 2010 2:42 PM
Subject: hash of Arrays
I am trying to place the date of each day of the week for each month
that has 5 weeks into a hash. For instance my hash key 'Monday' w
2010/1/17 Johnson, Reginald (GTS) :
> I am trying to place the date of each day of the week for each month
> that has 5 weeks into a hash. For instance my hash key 'Monday' would
> point to an array that has all the dates where Monday is in the fifth
> week of the month.
> I've got that part going.
Hi Reginald!
On Sunday 17 Jan 2010 21:42:21 Johnson, Reginald (GTS) wrote:
> I am trying to place the date of each day of the week for each month
> that has 5 weeks into a hash. For instance my hash key 'Monday' would
> point to an array that has all the dates where Monday is in the fifth
> week o
> "PP" == Philip Potter writes:
PP> 2009/11/11 Uri Guttman :
>> you can also simplify the copy a little with a hash ref:
>>
>> my $readfsgs_flags = { map { $_ => $flags->{$_} } @flags_to_copy } ;
PP> Is this really simpler than my version?
PP> @readfsgs_fla...@flags_to_copy} =
2009/11/11 Uri Guttman :
>> "PP" == Philip Potter writes:
>
> PP> my %readfsgs_flags;
> PP> my @flags_to_copy = qw(limit); # can scale up by adding more hash
> keys here
> PP> @readfsgs_fla...@flags_to_copy} = @{$flag...@flags_to_copy};
> PP> my @results = readfsgs($testfi
1 - 100 of 706 matches
Mail list logo