Beginner Perl Maven tutorial: 8.4 - finding a string in a file

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

This is not explicit enough. If you really want to help, you should go all the way. I have tried using a file handle, and then regex to look for a string within the file, but it doesn't find it:
#!/usr/bin/perl
system ("unzip -p harman_hisbo_15.odt meta.xml > meta.txt");
system ("touch result.txt");
open(INPUT, '<', 'meta.txt');
open(RESULT, '>', 'result.txt');
print RESULT "It matches\n" if (<INPUT> =~ /date/);
system ("less result.txt");
system ("touch -d 20080824 harman_hisbo_15.odt");
My aim is to use the date, or rather the digits following the string date, to change the file's date to the original creation date of the OpenOffice document. I don't understand why the file handle <INPUT> does not allow me to find anything in it. Would be great if you have a solution.

waxy