sem falar que esta usando open com 2 argumentos. tente usar com 3 argumentos separando o modo de abrir do nome do arquivo com uma virgula ao inves de um ponto para concatenar. alias vc pode interpolar assim
open my $fh,">","$nome.mp3"; ou open my $fh,">","${nome}.mp3"; On Sun, Oct 21, 2012 at 4:54 PM, Ole Peter Smith <ole....@gmail.com> wrote: > espacos no nome do arquivo? (sempre, como letras acentuadas, abominavel...) > > 0le > > Send via Android > On Oct 21, 2012 3:38 PM, "Aureliano Guedes" <guedes_1...@hotmail.com> > wrote: > >> Ola monges. >> >> Estou com problema para salvar arquivos *.mp3 recebidos via download. >> >> Ao salvar a mensagem retornada é 'print () on closed filehandle FH at >> C:\User\AG\Desktop\mes.pl line 31.'. >> >> O sistema so retorna 'Invalid argument' quando uso o $!. >> >> Então usei o autodie para ver o que me retornava: >> "Can't open '>Thaeme e Thiago - Ai que do.mp3' for writing: at 'Invalid >> argument' C:\User\AG\Desktop\mes.pl line 19." >> >> Enfim, não estou entendendo o erro retornado. >> >> http://pastebin.com/qxCMLv1V >> >> #!/usr/bin/env perl >> >> use common::sense; >> use WWW::Mechanize; >> use autodie; >> >> >> sub parse { >> my ($self) = shift; >> $self =~ s/\s+/\+/g; >> chomp $self; >> print "Now --> " . $self . "\n\n"; >> return ("http://www.buscamp3.org/busca/" . $self); >> } >> >> sub gd { >> my ($self, $name) = @_; >> print $self . " == " . $name . "\n\n"; >> open my $fh,">". $name . ".mp3"; >> my $m = WWW::Mechanize->new(); >> my $p = $m->get($self); >> $p = $p->decoded_content; >> $m->max_redirect(1); >> my @Links = $m->links(); >> my $w = 0; >> SWU: foreach my $link(@Links){ >> my @a = split ("/", $link->url()); >> if ($a[1] =~ m/dl/gi){ >> print "OK!\n"; >> my $c = $m->get("http://www.buscamp3.org" . $link->url()); >> print $fh $c->decoded_content; >> close $fh; >> $w = 1; >> } >> last SWU if ($w == 1); >> } >> undef $m; >> } >> >> >> open IN, $ARGV[0] or die; >> >> foreach (<IN>){ >> print "Search for: " . $_ . "\n"; >> my $a = parse($_); >> gd($a, $_); >> print "\n\n"; >> } >> >> _______________________________________________ >> Rio-pm mailing list >> Rio-pm@pm.org >> http://mail.pm.org/mailman/listinfo/rio-pm >> > > _______________________________________________ > Rio-pm mailing list > Rio-pm@pm.org > http://mail.pm.org/mailman/listinfo/rio-pm > -- Tiago B. Peczenyj Linux User #405772 http://pacman.blog.br
_______________________________________________ Rio-pm mailing list Rio-pm@pm.org http://mail.pm.org/mailman/listinfo/rio-pm