Comparing two strings for Anagram using hash [closed]Secure hash and salt for PHP passwordsHow can I generate an MD5 hash?Generate a Hash from string in JavascriptFinding anagrams for a given wordBug in the program for finding two strings are anagram or notAnagram-compare two stringsmake two strings anagramsChecking if two strings are anagramFind all anagram in a string how to optimize
Why can my keyboard only digest 6 keypresses at a time?
Moving points closer to polyline using ModelBuilder?
Is it legal for a bar bouncer to confiscate a fake ID
Why was this person allowed to become Grand Maester?
Bb13b9 confusion
How to safely destroy (a large quantity of) valid checks?
Why does logistic function use e rather than 2?
sed + add word before string only if not exists
Is it safe to change the harddrive power feature so that it never turns off?
A map of non-pathological topology?
Does the new finding on "reversing a quantum jump mid-flight" rule out any interpretations of QM?
How to ensure color fidelity of the same file on two computers?
Has there been a multiethnic Star Trek character?
Is it a bad idea to to run 24 tap and shock lands in standard
Who enforces MPAA rating adherence?
Russian word for a male zebra
CSV how to trim values to 2 places in multiple columns using UNIX
How to handle (one's own) self-harm scars (on the arm), in a work environment?
Determining fair price for profitable mobile app business
LuaLaTex - how to use number, computed later in the document
What ways have you found to get edits from non-LaTeX users?
Wooden cooking layout
How can I end combat quickly when the outcome is inevitable?
Generate basis elements of the Steenrod algebra
Comparing two strings for Anagram using hash [closed]
Secure hash and salt for PHP passwordsHow can I generate an MD5 hash?Generate a Hash from string in JavascriptFinding anagrams for a given wordBug in the program for finding two strings are anagram or notAnagram-compare two stringsmake two strings anagramsChecking if two strings are anagramFind all anagram in a string how to optimize
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I'm new to perl. Can anyone give an example to a perl code for detecting anagram between to given strings using hash's. two strings - pool and polo.
perl hash anagram
closed as off-topic by Stefan Becker, melpomene, Andy Lester, Dave Cross, Håkon Hægland Mar 24 at 22:38
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – Stefan Becker, melpomene, Andy Lester, Dave Cross, Håkon Hægland
add a comment |
I'm new to perl. Can anyone give an example to a perl code for detecting anagram between to given strings using hash's. two strings - pool and polo.
perl hash anagram
closed as off-topic by Stefan Becker, melpomene, Andy Lester, Dave Cross, Håkon Hægland Mar 24 at 22:38
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – Stefan Becker, melpomene, Andy Lester, Dave Cross, Håkon Hægland
See also Word::Anagram and rosetta code: anagrams
– Håkon Hægland
Mar 24 at 19:22
Much appreciate for your help. rosetta code: anagrams seems to be complicate for me to understand. can you show me some source with basic syntax.
– Pasupuleti Vinaykumar
Mar 24 at 19:45
You are welcome. The rosetta code looks quite simple, please explain what part of the code you do not understand. You could also take a look at the source code of theWord::Anagram
module. You can find it here
– Håkon Hægland
Mar 24 at 19:50
add a comment |
I'm new to perl. Can anyone give an example to a perl code for detecting anagram between to given strings using hash's. two strings - pool and polo.
perl hash anagram
I'm new to perl. Can anyone give an example to a perl code for detecting anagram between to given strings using hash's. two strings - pool and polo.
perl hash anagram
perl hash anagram
asked Mar 24 at 19:11
Pasupuleti VinaykumarPasupuleti Vinaykumar
1
1
closed as off-topic by Stefan Becker, melpomene, Andy Lester, Dave Cross, Håkon Hægland Mar 24 at 22:38
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – Stefan Becker, melpomene, Andy Lester, Dave Cross, Håkon Hægland
closed as off-topic by Stefan Becker, melpomene, Andy Lester, Dave Cross, Håkon Hægland Mar 24 at 22:38
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – Stefan Becker, melpomene, Andy Lester, Dave Cross, Håkon Hægland
See also Word::Anagram and rosetta code: anagrams
– Håkon Hægland
Mar 24 at 19:22
Much appreciate for your help. rosetta code: anagrams seems to be complicate for me to understand. can you show me some source with basic syntax.
– Pasupuleti Vinaykumar
Mar 24 at 19:45
You are welcome. The rosetta code looks quite simple, please explain what part of the code you do not understand. You could also take a look at the source code of theWord::Anagram
module. You can find it here
– Håkon Hægland
Mar 24 at 19:50
add a comment |
See also Word::Anagram and rosetta code: anagrams
– Håkon Hægland
Mar 24 at 19:22
Much appreciate for your help. rosetta code: anagrams seems to be complicate for me to understand. can you show me some source with basic syntax.
– Pasupuleti Vinaykumar
Mar 24 at 19:45
You are welcome. The rosetta code looks quite simple, please explain what part of the code you do not understand. You could also take a look at the source code of theWord::Anagram
module. You can find it here
– Håkon Hægland
Mar 24 at 19:50
See also Word::Anagram and rosetta code: anagrams
– Håkon Hægland
Mar 24 at 19:22
See also Word::Anagram and rosetta code: anagrams
– Håkon Hægland
Mar 24 at 19:22
Much appreciate for your help. rosetta code: anagrams seems to be complicate for me to understand. can you show me some source with basic syntax.
– Pasupuleti Vinaykumar
Mar 24 at 19:45
Much appreciate for your help. rosetta code: anagrams seems to be complicate for me to understand. can you show me some source with basic syntax.
– Pasupuleti Vinaykumar
Mar 24 at 19:45
You are welcome. The rosetta code looks quite simple, please explain what part of the code you do not understand. You could also take a look at the source code of the
Word::Anagram
module. You can find it here– Håkon Hægland
Mar 24 at 19:50
You are welcome. The rosetta code looks quite simple, please explain what part of the code you do not understand. You could also take a look at the source code of the
Word::Anagram
module. You can find it here– Håkon Hægland
Mar 24 at 19:50
add a comment |
1 Answer
1
active
oldest
votes
sub key(_) join "", sort split //, $_[0]
if (key("pool") eq key("polo")
say "Pool and polo are anagrams of each other.";
else
say "Pool and polo aren't anagrams of each other.";
If you had a dictionary,
sub key(_) join "", sort split //, $_[0]
my $dict_qfn = "...";
my $search = "pool";
my %anagrams;
open(my $fh, '<', $dict_qfn)
or die("Can't open "$dict_qfn": $!n");
while (<$fh>)
chomp;
push @ $anagrams key($_) , $_;
my @results = grep $_ ne $search @ $anagrams$search // [] ;
say "Anagrams of $search: ".( @results ? "@results" : "[none]" );
Any particular reason for using(_)
? (since you still writekey($_)
) Just feeling like using prototypes lately, or ... ?
– Dada
Mar 24 at 22:57
@Dada, I'm not taking advantage of it, but it's exactly the kind of function where the prototype could be useful
– ikegami
Mar 24 at 23:21
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
sub key(_) join "", sort split //, $_[0]
if (key("pool") eq key("polo")
say "Pool and polo are anagrams of each other.";
else
say "Pool and polo aren't anagrams of each other.";
If you had a dictionary,
sub key(_) join "", sort split //, $_[0]
my $dict_qfn = "...";
my $search = "pool";
my %anagrams;
open(my $fh, '<', $dict_qfn)
or die("Can't open "$dict_qfn": $!n");
while (<$fh>)
chomp;
push @ $anagrams key($_) , $_;
my @results = grep $_ ne $search @ $anagrams$search // [] ;
say "Anagrams of $search: ".( @results ? "@results" : "[none]" );
Any particular reason for using(_)
? (since you still writekey($_)
) Just feeling like using prototypes lately, or ... ?
– Dada
Mar 24 at 22:57
@Dada, I'm not taking advantage of it, but it's exactly the kind of function where the prototype could be useful
– ikegami
Mar 24 at 23:21
add a comment |
sub key(_) join "", sort split //, $_[0]
if (key("pool") eq key("polo")
say "Pool and polo are anagrams of each other.";
else
say "Pool and polo aren't anagrams of each other.";
If you had a dictionary,
sub key(_) join "", sort split //, $_[0]
my $dict_qfn = "...";
my $search = "pool";
my %anagrams;
open(my $fh, '<', $dict_qfn)
or die("Can't open "$dict_qfn": $!n");
while (<$fh>)
chomp;
push @ $anagrams key($_) , $_;
my @results = grep $_ ne $search @ $anagrams$search // [] ;
say "Anagrams of $search: ".( @results ? "@results" : "[none]" );
Any particular reason for using(_)
? (since you still writekey($_)
) Just feeling like using prototypes lately, or ... ?
– Dada
Mar 24 at 22:57
@Dada, I'm not taking advantage of it, but it's exactly the kind of function where the prototype could be useful
– ikegami
Mar 24 at 23:21
add a comment |
sub key(_) join "", sort split //, $_[0]
if (key("pool") eq key("polo")
say "Pool and polo are anagrams of each other.";
else
say "Pool and polo aren't anagrams of each other.";
If you had a dictionary,
sub key(_) join "", sort split //, $_[0]
my $dict_qfn = "...";
my $search = "pool";
my %anagrams;
open(my $fh, '<', $dict_qfn)
or die("Can't open "$dict_qfn": $!n");
while (<$fh>)
chomp;
push @ $anagrams key($_) , $_;
my @results = grep $_ ne $search @ $anagrams$search // [] ;
say "Anagrams of $search: ".( @results ? "@results" : "[none]" );
sub key(_) join "", sort split //, $_[0]
if (key("pool") eq key("polo")
say "Pool and polo are anagrams of each other.";
else
say "Pool and polo aren't anagrams of each other.";
If you had a dictionary,
sub key(_) join "", sort split //, $_[0]
my $dict_qfn = "...";
my $search = "pool";
my %anagrams;
open(my $fh, '<', $dict_qfn)
or die("Can't open "$dict_qfn": $!n");
while (<$fh>)
chomp;
push @ $anagrams key($_) , $_;
my @results = grep $_ ne $search @ $anagrams$search // [] ;
say "Anagrams of $search: ".( @results ? "@results" : "[none]" );
edited Mar 25 at 21:49
answered Mar 24 at 20:02
ikegamiikegami
272k11184413
272k11184413
Any particular reason for using(_)
? (since you still writekey($_)
) Just feeling like using prototypes lately, or ... ?
– Dada
Mar 24 at 22:57
@Dada, I'm not taking advantage of it, but it's exactly the kind of function where the prototype could be useful
– ikegami
Mar 24 at 23:21
add a comment |
Any particular reason for using(_)
? (since you still writekey($_)
) Just feeling like using prototypes lately, or ... ?
– Dada
Mar 24 at 22:57
@Dada, I'm not taking advantage of it, but it's exactly the kind of function where the prototype could be useful
– ikegami
Mar 24 at 23:21
Any particular reason for using
(_)
? (since you still write key($_)
) Just feeling like using prototypes lately, or ... ?– Dada
Mar 24 at 22:57
Any particular reason for using
(_)
? (since you still write key($_)
) Just feeling like using prototypes lately, or ... ?– Dada
Mar 24 at 22:57
@Dada, I'm not taking advantage of it, but it's exactly the kind of function where the prototype could be useful
– ikegami
Mar 24 at 23:21
@Dada, I'm not taking advantage of it, but it's exactly the kind of function where the prototype could be useful
– ikegami
Mar 24 at 23:21
add a comment |
See also Word::Anagram and rosetta code: anagrams
– Håkon Hægland
Mar 24 at 19:22
Much appreciate for your help. rosetta code: anagrams seems to be complicate for me to understand. can you show me some source with basic syntax.
– Pasupuleti Vinaykumar
Mar 24 at 19:45
You are welcome. The rosetta code looks quite simple, please explain what part of the code you do not understand. You could also take a look at the source code of the
Word::Anagram
module. You can find it here– Håkon Hægland
Mar 24 at 19:50