Search Results

Search: Posts Made By: yesokay
23,118
Posted By yesokay
Thanks, unfortunately what's happening when I...
Thanks, unfortunately what's happening when I implement that script with an else statement that prints "no key found for value" is, if the value is the third in the hash, for example:

no key found...
23,118
Posted By yesokay
Update, I made it through this by using: ...
Update, I made it through this by using:


if (exists $hash{$input}) {
print "This is equal to $hash{$input}\n";
}
else {
print "Not in hash\n";
...
23,118
Posted By yesokay
My hash, for example, looks like this One 1 ...
My hash, for example, looks like this

One 1
Two 2
Three 3


The user is prompted to enter in a word:

my $input = <STDIN>;
chomp $input;

I first wanted to use this if equals, but not...
23,118
Posted By yesokay
Perl Hash if exists
print $hash{$value} if exists $hash{$key};

would only print my top value, and not the one I want to "match".... should i not be using if exists? how would you recommend "searching" a hash...
1,998
Posted By yesokay
Great, thanks. I'll need to look into how and...
Great, thanks. I'll need to look into how and why this works. But it did.
1,998
Posted By yesokay
PERL I/O question
Playing with an until loop as follows:

my $input;

until ($input eq "quit") {
print "Please enter something:";
$input = <STDIN>;
chomp $input;
if ($input eq "dog") {
print "cat" ;
}
else...
Showing results 1 to 6 of 6

 
All times are GMT -4. The time now is 09:09 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy