#perl
26 October 2007
Total 31 pages. You are browsing page 3/31.
First :: Prev :: [1] [2] [3] [4] [5] [...] :: Next :: Last
01:10 <****> use strict;
01:10 <****> use File::Find;
01:10 <****> paste not in ye old chat room
01:10 <****> my $backup_location_parsed = "/log/ICHAIN/RSYNC_PLAIN_ICHAIN";
01:10 <****> find(\&ichain, "$backup_location_parsed");
01:10 <****> sub ichain {
01:10 <****> #-d and print "$File::Find::name\n" if /SENH/;
01:10 <****> -f and print "$File::Find::name\n"
01:10 <****> if (open(ARQUIVOS,"$File::Find::name")) {
01:10 <****> print ARQUIVOS;
01:10 <****> close(ARQUIVOS);
01:10 <****> ooh
01:10 <****> yucky!
01:11 <****> I can never understand the logic of that; why would someone think it appropriate to dump a large amount of text to a channel?
01:12 <****> Hi KyNDeR!
01:12 <****> KyNDeR: do NOT paste in here, use the paste bot
01:12 <****> perlbot, paste
01:12 <****> Paste your code to http://sial.org/pbot/perl http://erxz.com/pb or http://p3m.org/paste/fn/perl and #Perl will be able to view it.
01:12 <****> Somi ok...
01:12 <****> KyNDeR: it's considered polite when joining an IRC channel to -read the topic-
01:12 <****> Brazillian babes.
01:12 <****> KyNDeR: it usually considers hints about expected cnduct
01:12 <****> KyNDeR: in the case of this channel, the first three words are " Don't paste here"
01:12 <****> KyNDeR: that was a clue :)
01:12 <****> right mst, sorry
01:15 <****> ARQUIVOS, er, what? :)
01:16 <****> "KyNDeR" at 201.67.30.98 pasted "test" (9 lines, 220B) at http://sial.org/pbot/28253
01:16 <****> you forgot use warnings
01:16 <****> those lines give me the directories I want
01:16 <****> any one can remind me if /[^ @]/ means any characer other than space or '@'?
01:17 <****> LinuxMafia: yup.
01:17 <****> w3: Brazillian babes;
01:17 <****> LinuxMafia: perlreref's a quicker reminder than we are :)
01:17 <****> mst, thanks alot
01:17 <****> ARQUIVOS: please stop saying that
01:18 <****> ARQUIVOS, where?
01:18 <****> ;)
01:18 <****> ${WORKDIR}/${WORKFILE}
01:18 <****> w3: I can't talk about that any more.
01:18 <****> oops
01:19 <****> KyNDeR : dude ...
01:20 <****> "KyNDeR" at 201.67.30.98 pasted "Shell Script" (1 line, 258B) at http://sial.org/pbot/28254
01:21 <****> KyNDeR: ok, so what's the problem?
01:23 <****> Somni, I have to convert that shell script to perl.
01:23 <****> well, I'm not going to convert it for you, so you're going to have to put more effort into it than that
01:23 <****> if you're stuck, ask specific questions about the Perl you're working on
01:24 <****> Somni, but I don't know how. It's what I did http://sial.org/pbot/28253 - but I'm stucked
01:24 <****> system (sh /path/to/that/shell/script.sh); print 'finished!';
01:24 <****> KyNDeR: well, printing the matching directories is going to do you no good, so perhaps you should figure out how to get them into a form where you can continue processing them
01:25 <****> perhaps an array
01:25 <****> Somni, so can I put the result of that find into an array ?
01:26 <****> ya , just stuff in there
01:26 <****> -stuff it
01:26 <****> Somni, i'm on RE now :)
01:27 <****> perlnoob: uh huh
01:27 <****> Oh dear
01:28 <****> Somni, im becoming familiar with perl now
01:28 <****> Hahahahhahhahaha.
01:29 <****> whats funny dwu
01:29 <****> you are so mean, dwu
01:29 <****> I was trying very hard not to laugh in his face
01:30 <****> "perlnoob" at 59.40.205.141 pasted "#!perl use strict; print "type" (17 lines, 282B) at http://sial.org/pbot/28255
01:30 <****> i can write that, so i guess im not that bad as a new learner
01:30 <****> perlnoob: once more, $myhash{$_}++
01:30 <****> that replaces your entire exists ? ... : ...; line
01:30 <****> really
01:31 <****> you could reduce it even more, but perhaps that's enough
01:31 <****> how to reduce it
01:31 <****> Somni, can I create an array into subrotine ?
01:32 <****> KyNDeR: what?
01:32 <****> the first loop should be indented, like the second one
01:32 <****> how do i reduce it, Somni
01:32 <****> subroutine
01:33 <****> i thought it's reduced to maximum
01:33 <****> how do i reduce it, Somni
01:33 <****> perlnoob: various ways, but I'm afraid you'll just copy them without understanding them
01:33 <****> please stop repeating yourself, I saw you the first time
01:34 <****> i won't copy it
01:34 <****> i wil try my best to understand it
01:34 <****> hehe , it mee
01:34 <****> -it's
01:34 <****>;
01:35 <****> GumbyBRAIN: chomp
01:35 <****>; chomp; print.
01:35 <****>); my %lines; @lines{@lines} = (1) x @lines;
01:36 <****> } = ();
01:36 <****> Somni, somehting like @directories = read("$File::Find::name")
01:36 <****> that last one would require using exists instead of $lines{..} to check for duplicates
01:36 <****> the most direct is simply
01:37 <****> { chomp; $_ }
01:37 <****>) { chomp; $lines{$_}++ }
01:37 <****> anno-: ah yes
01:38 <****> perlnoob: notice how I didn't name it %myhash; name it for what's in it, not what type of variable it is
01:38 <****> everyone knows it's a hash, it has the % to prove it
01:38 <****> KyNDeR: I have no idea what you're asking
01:39 <****> yah that's because im noob you are expert
01:39 <****> perlnoob: hardly
01:39 <****> i cannot program perl like you do
01:40 <****> perlnoob: granted, but you can name variables so you have some idea of what they are, it doesn't take being an expert to do it
01:40 <****> ok thx for advice
Total 31 pages. You are browsing page 3/31.
First :: Prev :: [1] [2] [3] [4] [5] [...] :: Next :: Last
