in reply to list from file

Replace \$list with a file name - it's as simple as that. See the documentation for open.

The \$list syntax allows a string to be used as a file and is an excellent way of providing a "file" in a small stand alone sample script.

Generally if you don't understand everything that is going on in a script you should read the documentation (in this case "perldoc -f open" would help), or ask someone. Simply copying code you don't understand is "cargo culting" and is an excellent way of getting into bad habits and wasting a lot of time.

True laziness is hard work

Replies are listed 'Best First'.
Re^2: list from file
by persianswallow (Novice) on Jul 29, 2011 at 22:12 UTC

    thank you so much for your help and show a good link.

Re^2: list from file
by persianswallow (Novice) on Jul 29, 2011 at 23:33 UTC

    i have tried several ways to check my list. if i replace the file name instead of \$list the program will not use from my file.i tried to use this code instead to check my list element

    open (DOMAINLIST,'<domainlist') or die "cannot open 'domainlist'becuas +e:$!"; chomp(my @domain=<DOMAINLIST>); for my $domain(@domain){ my @array=@{$neighbours{$domain}};

    but there is a problem with reference that i couldn't solve it yet.then i came back to list.with replacing file name with \$list , my $list and its elements will not be useful , because \$list is a reference for that (i think) then i delete that,but still it doesn't work without error but no output.it shows that script hasn't opened the domainlist.