1. It will only read the first line. The time you want to be careful with <> is when you are assigning it to a list. For example, @myarray = <INFILE>; will assign the entire contents of the file, while $myscalar = <INFILE>; will assign only the first line.
2. In Windows, the endline character is interpreted as two characters, \n \r. This should not be an issue when dealing with binary files, since by definition you should not be dealing with them on a line by line basis (unless I'm forgetting something obvious). 3. This is a scoping issue. First, I'll write it out so it's easier to read. #version 1 sub any { for (@data) { my ($a, $b) = split (/=/, $_); } # $a and $b don't exist here anymore return 1; } #version 2 sub any { my $a, $b ; for (@data) { ($a, $b, $c) = split(/=/, $_); } # $a and $b still exist return 1; } 4. It shouldn't matter as far as I know. 5. I don't think you can, but I might be wrong. Usually There's More Than One Way To Do It. 6. I'm not sure what you're getting at. If you don't want to use something, just don't include it in your script, for the most part. Perhaps what you're asking is how to delay "use"ing something until you really need it? 7. ################# # s///e treats the right hand side as code to be evaluated first. $year = "It is YYYY."; $numYear = 2002; $year =~ s/YYYY/sprintf("%04d",$numYear)/e; #$year is now "It is 2002."; or $year =! s/YYYY/sprintf("%04d,$numYear)/; #$year is now "It is sprintf("%04d",$numYear)." ################# # s///g replaces all instances of the match $sentence = "One must always watch what one says in public."; $sentence =~ s/one/two/gi; #$sentence is now "two must always watch what two says in public." or $sentence =~ s/one/two/i; #$sentence is now "two must always watch what one says in public." 8. Not sure on this one. 9. Check CPAN http://search.cpan.org Whew! Good questions. I hope this puts you on the right track to a whole new mess of questions! :) -----Original Message----- From: Connie Chan To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: 3/22/02 1:30 PM Subject: Sort of Conceptual, Syntax, and modules related questions Dear All, I have sort of questions, would you please give me some hint, even refering me to a perldoc would be nice too. 1. When I open a text file with *lines, however, I just want to read the first line, would this be a good idea ? open (FILE, "textfile.txt"); $firstline = <FILE>; close (FILE); would this process run till EOF, or terminated after read $firstline ? 2. I am using Win32 system , would you tell when is \n apprear and when is \r\n apprear ? What about this when dealing with binary files ? 3. Is this different for this 2 scripts ? version 1 : sub any { for (@data) { my ($a, $b) = split (/=/, $_) } return 1 } version 2 : sub any { my $a, $b ; for (@data) { ($a, $b, $c) = split (/=/, $_) } return 1 } 4. Is that reading binary data faster then reading text file ? 5. How can I write multiple line if remark like /* and */ pairs, instead of using # at every line ? 6. Is that any syntax for local call about 'use' and 'require', so as something like 'not require', 'not use' expressions ? 7. Would you give me some short examples for //e, and //g ? I am confused for their usuage. 8. Any modules can help to check connecting threats for a certain page ? or if I run $alive = `ping $ip` a good idea ? 9. Any modules can help to read and write the ID3vX for mp3 files ? Any ideas and respond will be very very helpful..... Really urgent for a project design and development..... Thank you very much =) Connie -------------------------------------------------------------------------------- This email may contain confidential and privileged material for the sole use of the intended recipient. If you are not the intended recipient, please contact the sender and delete all copies. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]