Sponsored Content
Top Forums Shell Programming and Scripting How to map the values of an array in perl? Post 302524670 by getmmg on Tuesday 24th of May 2011 07:18:50 AM
Old 05-24-2011
Quote:
Originally Posted by vanitham
Hi,

I am just trying to do one -to one mapping. Map the elements in first array with second array.

How is it possible in hash?

Regards
Vanitha

You can convert the two arrays into hash and print it like below,
Code:
@hash{@names}=@files;
foreach(keys %hash){
print "$_ ---- $hash{$_}\n";
}

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

perl: Assigning array values..

I have to add a variable value to an array, something like this: ...... @my_array_name = $value_of_this_variable; This doesnt seem to work, any ideas why? Thanks! (4 Replies)
Discussion started by: looza
4 Replies

2. Shell Programming and Scripting

perl -write values in a file to @array in perl

Hi can anyone suggest me how to write a file containing values,... say 19 20 21 22 .. 40 to an array @array = (19, 20, ... 40) -- Thanks (27 Replies)
Discussion started by: meghana
27 Replies

3. Shell Programming and Scripting

PHP: Search Multi-Dimensional(nested) array and export values of currenly worked on array.

Hi All, I'm writing a nagios check that will see if our ldap servers are in sync... I got the status data into a nested array, I would like to search key of each array and if "OK" is NOT present, echo other key=>values in the current array to a variable so...eg...let take the single array... (1 Reply)
Discussion started by: zeekblack
1 Replies

4. Shell Programming and Scripting

Greping array values in Bash like Perl

Hi, Is there an easy way to simulate following Perl code in Bash. if ( grep {$my_value eq $_} @ARGV ){ print "Do Something\n"; } else { die "Invalid value"; } (0 Replies)
Discussion started by: paragkalra
0 Replies

5. Shell Programming and Scripting

Array or map Concept in Shell Script

Need a urgent help I have a data like below 044 CN CNP 032 MB MBD 567 NH NHI 678 GY GYP . . . . 250 records above data are loaded from a table ... I have a shell script which will read each line and in a specific position it has extn code like ... 044 or 032 ... i need... (3 Replies)
Discussion started by: greenworld123
3 Replies

6. Shell Programming and Scripting

Map values of blocks in a single line

Hello to all in forum, Maybe some awk expert could help me. I have this sample input: <MGISP:IMSIS=99995626; MT IMSI NUMBER SERIES ANALYSIS DATA OPERATING TABLE IMSIS M NA ANRES 99995626 6-77182 4 OBA-200 ... (9 Replies)
Discussion started by: Ophiuchus
9 Replies

7. Shell Programming and Scripting

Split string into map (Associative Array)

Hi Input: { committed = 782958592; init = 805306368; max = 1051394048; used = 63456712; } Result: A map (maybe Associative Array) where I can iterate through the key/value. Something like this: for key in $map do echo key=$key value=$map done Sample output from the map: ... (2 Replies)
Discussion started by: chitech
2 Replies

8. UNIX for Advanced & Expert Users

Search and replace a array values in perl

Hi, i want to search and replace array values by using perl perl -pi -e "s/${d$i]}/${b$j]}" *.xml i am using while loop for the same. if i excute this,it shows "Substitution replacement not terminated at -e line 1.". please tell me what's wrong this line (1 Reply)
Discussion started by: arindam guha
1 Replies

9. Shell Programming and Scripting

Perl : Assigning multile hash values to a single array

I know that @food = %fruit; Works. But how do I assign %fruit and %veggies to @food ? (2 Replies)
Discussion started by: popeye
2 Replies

10. Shell Programming and Scripting

Perl next if @array (exclude a list of values)

I'm trying to exlude a list of values with perl to process while reading in a file. Is there a way to use the next if with a list? Example: @array = qw(val1 val2 val3 val6); while (<>) { next if $_ =~ @array; # values I don't want to process here print; # process the rest here }... (8 Replies)
Discussion started by: timj123
8 Replies
PASSWORD_VERIFY(3)							 1							PASSWORD_VERIFY(3)

password_verify - Verifies that a password matches a hash

SYNOPSIS
boolean password_verify (string $password, string $hash) DESCRIPTION
Verifies that the given hash matches the given password. Note that password_hash(3) returns the algorithm, cost and salt as part of the returned hash. Therefore, all information that's needed to verify the hash is included in it. This allows the verify function to verify the hash without needing separate storage for the salt or algorithm information. PARAMETERS
o $password - The user's password. o $hash - A hash created by password_hash(3). RETURN VALUES
Returns TRUE if the password and hash match, or FALSE otherwise. EXAMPLES
Example #1 password_verify(3) example <?php // See the password_hash() example to see where this came from. $hash = '$2y$07$BCryptRequires22Chrcte/VlQH0piJtjXl.0t1XkA8pw9dMXTpOq'; if (password_verify('rasmuslerdorf', $hash)) { echo 'Password is valid!'; } else { echo 'Invalid password.'; } ?> The above example will output: Password is valid! SEE ALSO
password_hash(3), userland implementation. PHP Documentation Group PASSWORD_VERIFY(3)
All times are GMT -4. The time now is 09:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy