open(F,"c:\\file.txt");
open(O,">c:\\fileheic.txt");
while (<F>) {
    $U++;
    print "$U $_";
    my $jpg="U:\\iPhone(Qialing)\\$_";
open(H,$jpg)||print "open fail\n";
while(<H>) {
    my $heic=$_;
if($heic=~/^\x00\x00\x00\x18\x66\x74\x79\x70\x68/){
  #print "Heic: $jpg";
  print O "$jpg";
}else{
  #print "Jpg: $jpg";  
}
last;
}
close H;
}
close F;
close O;