Home Page   #c  #ruby-lang  #cisco  #mysql  #apache  #javascript  #java  #perl  #php  #openmoko   Wallpapers Girl
Reliable $1 Web Hosting by 3iX

Channels


#perl

10 October 2007


Total 40 pages. You are browsing page 2/40.

First :: Prev :: [1] [2] [3] [4] [5] [...] :: Next :: Last

01:02 * iank smacks dkr
01:03 <****> neat, ruby core implements ST
01:03 <****> Enumerable#sort_by
01:06 <****> does dbm::deep have some kind of 4G db size limit or something?
01:11 * rhizo realized he's unknowingly known another language - once you get past the novelty of iterators, endemic sigils and slightly inferior regexen, ruby gives a feel of a familiar place
01:13 * jagerman grumbles something about lack of proper understand of what a character is
01:14 <****> depends on the context, jagerman: a sequence of bytes in unicode, or a 'traditional' ascii byte - you can impose char. semantics as needed
01:16 <****> except a large majority of programmers conflate 'character' with 'byte' and it causes problems fast
01:16 <****> rhizo: Have they fixed that, then? Ruby didn't used to support things like string length for non-character-as-byte strings
01:17 <****> jagerman: i'd think so, perhaps see ri String
01:18 * rhizo recalls seeing built-ins for matching unicode chars in String
01:18 <****> Seems silly that a language developed by someone in the Far East wouldn't support Unicode and UTF-8 or so from the beginning.
01:19 <****> Japanese aren't big on unicode, apparently.
01:20 <****> "A +String+ object holds and manipulates an arbitrary sequence of bytes, typically representing characters."
01:20 <****> Yeah.
01:20 <****> Great.
01:21 <****> most agreeably, ruby sports closures, although sometimes they seem to get in the way, like when the topic var of an iterator block aliases a lexical from nearest scope
01:22 <****> does perl allow a way of creating a slice of non-sequential numbers (for example a slice of even or odd integers)?
01:23 <****> concave: Not really, though you could do something like:
01:23 <****> eval: [grep $_%2, 1 .. 15];
01:23 <****> jagerman: [1,3,5,7,9,11,13,15]
01:24 <****> eval: @ary = (0..16); [@ary[grep $_%2, 1 .. 15]]
01:24 <****> apeiron: [1,3,5,7,9,11,13,15]
01:24 <****> Or that.
01:24 <****> :)
01:24 <****> That's the same thing. :(
01:24 <****> jagerman, Showing that it can directly slice an array, though.
01:24 <****> thanks jagerman and apeiron :)
01:24 <****> But he said "a slice of numbers"
01:25 * apeiron shrugs.
01:25 <****> So I guess it could be interpreted either way.
01:25 <****> @array[ map 2*$_ + 1, 0 .. @array/2]
01:26 <****> anno-: Except... that would access $array[9] in an 8-element array.
01:27 <****> yeah... untested. of by one must be taken for granted :)
01:27 <****> off
01:27 <****> @array[map 2*$_ - 1, 1 .. @array/2] # perhaps
01:28 <****> jagerman: some String methods are indeed inconsistent on unicode; sucks, but isn't there Unicode class; also, iirc, Rails treats utf8 properly by default
01:29 <****> jagerman: looks good
01:38 * sono lurks, wanting to learn
01:39 <****> no learning!
01:39 * sono puts Somni back into bed
01:39 <****> GumbyGumby will pop in his dentures and come after you!
01:39 <****> Supaplex: And you will be remembered long after.
01:39 <****> how dare you, sir
01:47 * amnesiac puts Somni to learn PERL
01:48 <****> if i want to make a system() call, how would i specify the current working directory? this was my error message : collect_anycraze.pl died on calling system("/usr/bin/perl", "./parse_anycraze.pl",
01:49 <****> change it before calling system
01:49 <****> is it necessary to invoke use Cwd ?
01:50 <****> to change the current directory? no, to change it back afterward, yes
01:50 <****> hmm. can you show me
01:51 <****> show you what?
01:51 <****> kung fu
01:51 <****> changing the working directory so that the . correctly references the right location
01:51 <****> show me the money
01:51 <****> perldoc -f chdir
01:53 <****> hmm. how would i chdir to my current working directory ? i can't specify the actual path, it defeats the purpose... but chdir takes an EXPR
01:53 <****> "."
01:53 <****> why would you change your current working directory to your current working directory?
01:53 <****> (may not work on some platforms)
01:53 <****> there's no change, it's pointless
01:54 <****> because the current working directory in perl instance is not necessarily going to be the same current working directory in bash.
01:54 <****> you aren't making any sense
01:54 <****> File::Basename
01:54 <****> current working directory is per-process, not per application type
01:54 <****> and when you pass a list to system it doesn't call bash or any other shell
01:55 <****> even if it did, the current directory for that process would still be the current directory of the parent
01:55 <****> i see
01:58 <****> when you write on the command line in bash "perl foo.pl", how does perl know wher ethe directory for foo.pl is? does it import this?
01:58 <****> it looks in the current directory, that's it
01:59 <****> hello.
01:59 <****> perl looks in the current directory.but how does it know what the current directory is?
01:59 <****> how do I pass a filehandle to a subroutine?
01:59 <****> bash knows, how does perl know?
02:00 <****> convivial, open my $file, '<', 'filename'; # always use scalars as filehandles and you have no problem
02:00 <****> rookpawn: the OS knows; when you attempt to open a relative filename the OS essentially prepends the current directory
02:00 <****> my @col=();
02:00 <****> for (my $i=0; $i<scalar(@{$CIBC31::AnnexeII::noms_colonnes{"fin de bilan"}}); $i++)
02:00 <****> {
02:00 <****> push @col, values(%{$CIBC31::AnnexeII::noms_colonnes{"fin de bilan"}[$i]});
02:00 <****> }even if it did, the current directory for that process would still
02:00 <****>
02:00 <****> do not paste code here
02:00 <****> even if it did, the current directory for that process would still
02:00 <****> 
02:00 <****> .
02:01 <****> cat-like typing detected!
02:01 <****> although shell may expand or insert, it doesnt necessarily mean that is where cwd in perl is getting its data from.
02:01 <****> rookpawn: cwd is not some variable the current process holds and can decide to use or not, it's something you tell the OS, and the OS uses it to resolve relative filenames
02:02 <****> in fact, im positive perl does NOT get the cwd by the prepended part
02:02 <****> you're making even less sense, now
02:02 <****> yeah, seriously, the kernel keeps track of this stuff
02:02 <****> you ask it to change it ... if it's willing
02:02 <****> and I can't fathom why you'd be certain of something like this when you have to ask so many questions about it
02:02 <****> Sorry, my mouse is dying. I have a lost of synchro.
02:03 <****> because i know that the cwd can be requested and read from within perl.
02:03 <****> this channel has gone crazy in the past couple hours
02:03 <****> rookpawn: yes, it can be determined, and can be set, that doesn't make it an internal variable
02:03 <****> rookpawn: just like your PID isn't an internal variable
02:04 <****> you can look at it if you like ... ls -ald /proc/$$/cwd/ ... it works the same from perl...
02:04 <****> "kb3llm" at 24.209.47.228 pasted "problem installing Text::Aspell" (251 lines, 16.7K) at http://sial.org/pbot/27968


Total 40 pages. You are browsing page 2/40.

First :: Prev :: [1] [2] [3] [4] [5] [...] :: Next :: Last


Tutti i nuovi CAP Italiani. Come ottenere il database completo