
jigneshjsoni
User
Apr 18, 2008, 7:36 AM
Post #1 of 2
(895 views)
|
<DATA> FILEHANDLE
|
Can't Post
|
|
print "Content-Type: text/html\n\n";for ( <DATA> ) { #skip blank lines next if /^$/; ($key, $value) = split /\s*,\s*/; $hyperlink{$key} = $value; #Once you've printed the header, #you can print diagnostics to the browser window! print "$key, $value<br>\n";}open HTML, "editing.html" or die $!;while( <HTML> ) { for $key ( keys %hyperlink ) { s(\s$key\s) ( <a href="$hyperlink{$key}" style="background:silver">$key</a> ); } print;}close HTML;__DATA__special, http://www.m-w.comcode, javascript:alert('Code!')example, course/index.html In this example (taken from www.gossland.com), filehandle (<DATA>) is used with FOR loop and (<HTML>) is used with WHILE loop. Can we use FOR loop with (<HTML>) and WHILE loop with (<DATA>) ?
|