Posted below is a shortened down version of a larger script that tries
to show the phenomena I'm seeing and don't understand.

I'm running rsync from a perl script so I first thought the output
was from rsync, but as I tinkered around I began to notice that as I
changed things around a bit, the lines that puzzled me disappeared.
I couldn't discover what it was I changed and lost track.

Output from rsync shows this at the start of every line:

`GLOB(0x8117548)'

But just to show that its coming from perl; if I pass the content of
($_) to a variable ($line) the prepended data disappears... (You may
note that bit commented out below)

So, the code as shown below prepends 'GLOB(0x8117548)'
to every line of outpout.
-------        ---------       ---=---       ---------      -------- 
 
#!/usr/local/bin/perl

use strict;
use warnings;
use File::Which;


my $dst = '/rmh/m2/phonepics';
my $src =
'harry@m2:/cygdrive/d/ImagesMusic/ImageDB/images/imageArch/00inc/phonepics';

my $exclf = '/rmh/m2/x-scr/exclf';
my $longargs = "--stats --exclude-from=$exclf";
my $shortargs = '-navz';
my $rsync = which('rsync');
my $dtf = 'yymmdd_hhmmss';
my $log = './log/rsy.log';

open my $fh, '>>',$log  or die "Can't open <$log>: $!";
print " $dtf START $rsync $shortargs\n   $longargs\n      $src/ $dst/\n\n";
open my $cmdh, '-|', "$rsync $shortargs $longargs $src/ $dst/" or die "ERROR 
running <$rsync>: $!";

#my $line;
while(<$cmdh>) {
  print $fh;
  print;
#  $line = $_;
#  print $fh $line;
#  print $line;
}

close $cmdh;
close $fh;

sub usage {
 print "
 Purpose:
 usage: "
}

-------        ---------       ---=---       ---------      -------- 
Output:

[...]
GLOB(0x81573f8)samgalaxn2_phone/pswrk/done/20130905_095712.jpg
GLOB(0x81573f8)samgalaxn2_phone/pswrk/done/20130905_100306.jpg
GLOB(0x81573f8)samgalaxn2_phone/pswrk/done/20130905_100312.jpg
[...]


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to