M
Mostafa
open(PH,"customers.txt") or die "Cannot open customers.txt: $!\n";
while(<PH>) {
chomp;
($number, $email) = ( split(/\s+/, $_) )[1,2];
$Phone{$number} = $_;
$Email{$email} = $_;
}
close(PH);
*******************************************************************
i couldn't find what does this expression means in split function
[1,2]
**********************************************************************
i am also including the customers.txt file below
********************************************************************
Smith,John (248)-555-9430 (e-mail address removed)
Hunter,Apryl (810)-555-3029 (e-mail address removed)
Stewart,Pat (405)-555-8710 (e-mail address removed)
Ching,Iris (305)-555-0919 (e-mail address removed)
Doe,John (212)-555-0912 (e-mail address removed)
Jones,Tom (312)-555-3321 (e-mail address removed)
Smith,John (607)-555-0023 (e-mail address removed)
Crosby,Dave (405)-555-1516 (e-mail address removed)
Johns,Pam (313)-555-6790 (e-mail address removed)
Jeter,Linda (810)-555-8761 (e-mail address removed)
Garland,Judy (305)-555-1231 (e-mail address removed)
***********************************************************************
i guess [1,2 ]somehow saves phone and email column to $number and
$email , nnow if i want to retrive name from the .txt file , then
should i do like below---
*************************************************************************
open(PH,"customers.txt") or die "Cannot open customers.txt: $!\n";
while(<PH>) {
chomp;
($name, $number, $email) = ( split(/\s+/, $_) )[0,1,2];
$Name{name} = $_;
$Phone{$number} = $_;
$Email{$email} = $_;
}
close(PH);
***********************************************************************
i did but it's not working
********************************************************************
any clue?????????
while(<PH>) {
chomp;
($number, $email) = ( split(/\s+/, $_) )[1,2];
$Phone{$number} = $_;
$Email{$email} = $_;
}
close(PH);
*******************************************************************
i couldn't find what does this expression means in split function
[1,2]
**********************************************************************
i am also including the customers.txt file below
********************************************************************
Smith,John (248)-555-9430 (e-mail address removed)
Hunter,Apryl (810)-555-3029 (e-mail address removed)
Stewart,Pat (405)-555-8710 (e-mail address removed)
Ching,Iris (305)-555-0919 (e-mail address removed)
Doe,John (212)-555-0912 (e-mail address removed)
Jones,Tom (312)-555-3321 (e-mail address removed)
Smith,John (607)-555-0023 (e-mail address removed)
Crosby,Dave (405)-555-1516 (e-mail address removed)
Johns,Pam (313)-555-6790 (e-mail address removed)
Jeter,Linda (810)-555-8761 (e-mail address removed)
Garland,Judy (305)-555-1231 (e-mail address removed)
***********************************************************************
i guess [1,2 ]somehow saves phone and email column to $number and
$email , nnow if i want to retrive name from the .txt file , then
should i do like below---
*************************************************************************
open(PH,"customers.txt") or die "Cannot open customers.txt: $!\n";
while(<PH>) {
chomp;
($name, $number, $email) = ( split(/\s+/, $_) )[0,1,2];
$Name{name} = $_;
$Phone{$number} = $_;
$Email{$email} = $_;
}
close(PH);
***********************************************************************
i did but it's not working
********************************************************************
any clue?????????