I am trying to write a program using perl which will display the contents of a file in the same format as it is(i dont want to read the contents of the file on the command prompt)....and then ill search for the particular string in it but thats next part...first i want to
How to open a file in txt/html/xml format using a perl program?
Please correct me if i am wrong in understanding your plroblem, is it that you want to view contents of text file in notepad and xml or html in IE, or you just simply want to read the data?
For the former soultion is like..
@Filenames = @ARGV;
foreach (@Filenames) {
$file = $_;
if ( $file =~ /.+\.txt$/i ) {
print "text file";
system("notepad $file");
if ( $file =~ /.+\.xml$/i ) {
print "xml file";
system("iexplore $file");
}
For opening txt file you can use open FH, $filname;(read mode)
for reading XML files you can use
use XML::Simple;
}
Reply:Take a read at these tutorials:
http://www.pageresource.com/cgirec/ptut1...
http://builder.com.com/5100-6372-5314579...
http://perl.about.com/od/perltutorials/a...
eurovision song contest
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment