Thread PHP-Script in Perl umwandeln (6 answers)
Opened by Henri at 2015-03-30 09:19

Gast Henri
 2015-03-30 10:34
#180451 #180451
Also eingentlich lauft das code, leider erfüllt nicht mein Wünsche , ich würde gern dass das Code was ich in Perl hat mir den unterschied auf jede File zeigt, weil perl kenne ich mich nicht aus aber PHP wäre schon besser die PHP code gibt mir zu beispeil die folgende Ausgabe, sagt mir ganz genau wo der unterschied liegt

CATALOG:
f1-id = sysdumpdevParam
f2-id = sysdumpdevParam_x

PARAMETER:
f1-name-1 = secondary
f2-name-1 = secondary_a
f1-name-5 = type_of_dump
f2-name-5 = type_of_dumper

mein Perl-Code hier unter schafft es leider nicht

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
use strict;          
use warnings;        
use File::Compare;   


my %exclude;         
my $file1 = 'default_sysdumpdev_150319.txt';
my $file2 = 'd100spuptl25e0_sysdumpdev.txt';
my $compare = compare('d100spuptl25e0_sysdumpdev.txt', 'default_sysdumpdev_150319.txt');
   
open my $file, '<', 'default_sysdumpdev_150319.txt' or die $!; 
while (<$file>) {
  chomp;             
  $exclude{$_}++;    
}


my $txtdatei = 'compare.txt';              
open my $txtfh, '>', $txtdatei or die $!;  

open $file, '<', 'd100spuptl25e0_sysdumpdev.txt' or die $!;
                                                            
while (<$file>) {
  chomp;            
  if($compare == 1){   
  
  #print $txtfh "False! the files are not equal \n";    
 
  print $txtfh "FALSE! $_\n" unless $exclude{$_};             
                                                       

  }
  elsif($compare == 0){ 
             
  print $txtfh "True! the Files are equal \n";         
  }
}
close $txtfh;


modedit Editiert von pq: code-tags hinzugefügt
Last edited: 2015-03-30 12:37:48 +0200 (CEST)

View full thread PHP-Script in Perl umwandeln