May 05 15:52:06 --> sas123 (n=sas@59.95.17.77) has joined #perlcafe May 05 15:52:10 hi May 05 15:52:23 Hi sas123 May 05 15:52:26 rindolf: I am here May 05 15:52:28 sas123: OK. May 05 15:52:53 why this channel? May 05 15:52:58 Try going over http://www.shlomifish.org/lecture/Perl/Newbies/ - at least the reference parts. May 05 15:53:12 sas123: #perlcafe was supposed to host off-topic #perl discussion. May 05 15:53:17 sas123: but that didn't work. May 05 15:53:29 It now hosts a lot of discussion that we'd rather not see on #perl. May 05 15:53:34 what does it cater to now May 05 15:53:40 oh May 05 15:53:42 And some more Perl-related discussion. May 05 15:53:46 Or computer-related. May 05 15:53:57 sas123: wait a sec. May 05 15:54:01 perlbot: faq May 05 15:54:02 The #perl FAQ is at http://perl.net.au/wiki/Freenode_Sharp_Perl_FAQ May 05 15:54:34 sas123: http://perl.net.au/wiki/Freenode_Sharp_Perl_FAQ#.23perlcafe May 05 15:54:45 k May 05 15:54:54 sas123: anyway, why aren't you using "use strict;" and "use warnings;"? May 05 15:55:05 a sec May 05 15:55:06 sas123: you should as a general rule add them to all scripts. May 05 15:56:19 rindolf: ok May 05 15:57:35 rindolf: I HATE THOSE TWO May 05 15:57:55 rindolf: they make the learning curve steep May 05 15:58:21 sas123: yes, but they prevent many common errors. May 05 15:58:28 sas123: do you know my() and stuff? May 05 15:58:43 rindolf: yes May 05 15:58:46 sas123: or should I explain about declaring your variables? May 05 15:58:53 no May 05 15:59:08 sas123: without use strict you can easily mistype the name of your variables. May 05 15:59:16 k May 05 15:59:52 I also know a bit about references but do not know how to use them May 05 16:01:11 rindolf: can you help me with the problem? May 05 16:01:30 sas123: I can try. May 05 16:01:37 sas123: OK - references. May 05 16:01:41 rindolf: shall I start ? May 05 16:01:50 sas123: first read: http://www.shlomifish.org/lecture/Perl/Newbies/lecture2/references/ May 05 16:01:56 sas123: yes. May 05 16:02:19 rindolf: shall I read first or ask? May 05 16:02:27 sas123: read first, it's not too long. May 05 16:05:02 rindolf: read it but did not get this - The reference of any array may be taken, and a reference to an array may always be converted to its elements, but there is still a difference in functionality. May 05 16:05:22 sas123: ah. May 05 16:05:29 sas123: OK, where do you see that? May 05 16:05:50 In the URL you gave May 05 16:06:08 sas123: I meant that there's a difference between the contents of the array the reference points to and the reference itself. May 05 16:06:24 sas123: are you familiar with how a computer works? RAM, memory, etc.? May 05 16:06:31 yes May 05 16:06:35 sas123: OK. May 05 16:07:05 sas123: so what a reference does is say: "This cell, instead of holding a string will hold a pointer to a data structure". May 05 16:07:16 Let's say this data structure is an array. May 05 16:07:28 So we access this array using @{$array_ref} May 05 16:07:35 Or $array_ref->[0] or whatever. May 05 16:07:42 And then treat as an array. May 05 16:07:53 you lost me May 05 16:07:56 Except that instead of being a first-order variable. May 05 16:07:59 sas123: OK. May 05 16:08:02 sas123: sorry. May 05 16:08:07 wait May 05 16:08:11 sas123: maybe I should draw it. May 05 16:08:16 "This cell, instead of holding a string May 05 16:08:17 will hold a pointer to a data structure". May 05 16:08:18 I've got Inkscape here. May 05 16:08:20 And dia. May 05 16:08:25 sas123: yes. May 05 16:08:34 is the english right here? May 05 16:09:25 I didn't get the above line May 05 16:10:06 wait not technicially, but literally May 05 16:11:09 sas123: yes. May 05 16:11:29 Let's say you have a nice cell called $myvar OK. (short for myvariable. May 05 16:11:40 $myvar==[ "Hello sas123" ] May 05 16:11:47 Which means it holds a string. May 05 16:11:53 sas123: got it? May 05 16:12:02 sas123: this is a simple scalar variable. May 05 16:12:06 $myvar = 'Hello sas123' ? May 05 16:12:15 yes May 05 16:12:20 sas123: that's how you'll assign to it. May 05 16:12:33 --> railbait (n=railbait@wsip-70-164-66-49.ok.ok.cox.net) has joined #perlcafe May 05 16:12:36 sas123: but mynotation indicates that $myvar contains the string "Hello sas123". May 05 16:12:39 These are its contents. May 05 16:12:43 k May 05 16:12:46 sas123: OK. May 05 16:12:54 ok May 05 16:12:57 sas123: now, we can put any string we want inside $myvar. May 05 16:13:29 sas123: but, strings alone are hard to work with. May 05 16:13:36 ok May 05 16:13:39 sas123: so Perl 5 added the concept of references. May 05 16:13:48 sas123: which can also be thought of as pointers. May 05 16:14:12 Now let's suppose I write in Perl «$myvar = [5,6,"sas123"];» May 05 16:14:14 ok May 05 16:14:35 what is that? May 05 16:14:38 sas123: in this case what happens is that $myvar will hold the memory address of an array. May 05 16:14:44 sas123: that's notation. May 05 16:14:49 [ .... ] is a dynamic array. May 05 16:15:01 ok May 05 16:15:20 But [....] is still technically a single (= "scalar") value. May 05 16:15:27 ok May 05 16:16:01 sas123: Now what happens is that myvar would be $myvar==[ *MyPtr*] where *MyPtr* is a pointer to an array in memory. May 05 16:16:13 sas123: let's try it. May 05 16:16:27 buubot: my $myvar = [5, 6, "sas123"], [$myvar] May 05 16:16:35 buubot: eval: my $myvar = [5, 6, "sas123"], [$myvar] May 05 16:16:36 rindolf: [undef] May 05 16:16:42 buubot: eval: my $myvar = [5, 6, "sas123"]; [$myvar] May 05 16:16:43 rindolf: [[5,6,"sas123"]] May 05 16:16:45 OK. May 05 16:16:50 buubot: eval: my $myvar = [5, 6, "sas123"]; ["$myvar"] May 05 16:16:51 rindolf: ["ARRAY(0x9e9f7e8)"] May 05 16:16:54 a sec May 05 16:17:11 --> ispy_ (n=ispyhuma@67.59.59.227) has joined #perlcafe May 05 16:17:46 ok May 05 16:18:05 wait May 05 16:18:15 Hi ispy_ May 05 16:18:23 ispy_: we're explaining references to sas123 May 05 16:18:33 why is "" making a difference May 05 16:18:46 Yo May 05 16:18:49 sas123: because " stringifies a variable. May 05 16:19:12 ok May 05 16:20:00 sas123: you cannot do too much with the string "ARRAY(0x...)" but as you see that what Perl displays if you tells it to. May 05 16:20:11 yes May 05 16:20:16 sas123: it's just Perl's weird way of saying it's a reference as fer as she's concerned. May 05 16:20:33 yes May 05 16:20:46 sas123: OK. May 05 16:20:50 sas123: now if we do. May 05 16:21:05 buubot: eval: my $myvar = [5, 6, "sas123"]; $myvar->[0] May 05 16:21:06 rindolf: 5 May 05 16:21:09 buubot: eval: my $myvar = [5, 6, "sas123"]; $myvar->[1] May 05 16:21:10 rindolf: 6 May 05 16:21:12 buubot: eval: my $myvar = [5, 6, "sas123"]; $myvar->[2] May 05 16:21:13 rindolf: "sas123" May 05 16:21:29 wait May 05 16:21:34 See? The -> allows us to access the array referred to by the reference. May 05 16:22:07 what would $myvar->[0] mean in English May 05 16:23:33 ? May 05 16:25:19 rindolf: you there? May 05 16:25:41 sas123: yes, sorry. May 05 16:25:44 sas123: got distracted. May 05 16:25:49 sas123: I'm going to disconnect my Inet now. May 05 16:25:52 sas123: stay tuned. May 05 16:25:56 sas123: meanwhile ask ispy_ May 05 16:25:59 Bye. May 05 16:26:01 Sup. May 05 16:26:06 Oh yeah... May 05 16:27:46 --- Disconnected (). **** ENDING LOGGING AT Mon May 5 16:27:46 2008 **** BEGIN LOGGING AT Mon May 5 16:28:09 2008 May 05 16:28:09 --> You are now talking on #perlcafe May 05 16:28:09 --- Topic for #perlcafe is Happy Birthday Rindolf, you crazy bastard | my moths. let me show you them May 05 16:28:09 --- Topic for #perlcafe set by rindolf at Mon May 5 11:41:11 2008 May 05 16:28:14 Hi. May 05 16:28:18 sas123: I'm rindolf. May 05 16:29:19 sas123: OK. May 05 16:29:43 ok May 05 16:29:50 In English $myvar->[0] means "Give me the 0'th element ([0]) out of the array pointed to (->) by $myvar" May 05 16:30:05 The notation is shorter because Perl is not COBOL. May 05 16:30:07 k May 05 16:30:29 ok May 05 16:30:30 And we thank $DEITY that it isn't. May 05 16:30:35 :-) May 05 16:31:36 sas123: we can also do @{$myvar} May 05 16:31:43 Which will give us the entire array. May 05 16:31:47 Or ${$myvar}[0] May 05 16:32:01 Which is like $myarray[0] for @myarray. May 05 16:32:02 ok May 05 16:32:49 what does ${$myvar}[0] give - is it same as $myvar->[0] May 05 16:34:21 TMTOWTDI May 05 16:34:23 =] May 05 16:34:48 I think you should stick with ->. It's clearly defined and modern imho. May 05 16:34:49 ok May 05 16:34:53 ok May 05 16:36:43 sas123: yes, ${$myvar}[0] is the same as $myvar->[0] May 05 16:36:56 But I was just showing that you can treat @{$myvar} as an array. May 05 16:37:04 sas123: often the {...} are optional. May 05 16:38:20 rindolf: how is @{$myvar} read in english? May 05 16:38:46 sas123: the array (@) referred to by the pointer contained in $myvar. May 05 16:39:51 oh ok May 05 16:41:07 sas123: are you ready for more complicated examples? May 05 16:41:57 yes May 05 16:42:00 sas123: ok. May 05 16:43:50 sas123: well, now, every element of the array we refer to is also a full-fledged scalar. May 05 16:44:01 sas123: and it in turn can hold references. May 05 16:44:05 sas123: so I can say: May 05 16:44:47 a sec to read May 05 16:44:56 buubot: eval: my $array_ref = [5,6, ["Hello", "sas123"], ["this", "is", "rindolf"],]; $array_ref->[2]->[1]; May 05 16:44:57 rindolf: "sas123" May 05 16:45:01 ok May 05 16:45:21 ok May 05 16:45:26 sas123: got it. May 05 16:45:43 sas123: now try to write "rindolf", using the $array_ref I gave. May 05 16:46:38 $array_ref->[3]->[2] May 05 16:46:56 sas123: try it. May 05 16:47:06 sas123: use "buubot: eval:" May 05 16:47:19 sas123: are you using a GUI IRC client? May 05 16:47:46 no May 05 16:47:54 sas123: ok. May 05 16:48:06 sas123: then let me type it. May 05 16:48:17 buubot: eval: my $array_ref = [5,6, ["Hello", "sas123"], ["this", "is", "rindolf"],]; $array_ref->[3]->[2] May 05 16:48:18 rindolf: "rindolf" May 05 16:48:24 Yay! May 05 16:48:26 sas123++ May 05 16:48:55 sas123: OK. May 05 16:49:14 rindolf, you are a really swell guy May 05 16:49:16 sas123: naturally we can have array refs to array refs to array refs (and so on.) May 05 16:49:20 q[ender]: thanks. :-) May 05 16:49:53 right May 05 16:50:30 sas123: OK. May 05 16:50:35 sas123: now, next lesson. May 05 16:50:40 okay hey guys May 05 16:50:43 sas123: other types of her. May 05 16:50:45 Diablo-D3: hi. May 05 16:50:52 sas123: other types of *refs*. May 05 16:50:54 Thinko. May 05 16:53:11 rindolf: ? May 05 16:54:15 sas123: I'd like to continue the discussion. May 05 16:54:23 You can use the equivalence property of p-norms to rate your data May 05 16:54:28 And write it yourself May 05 16:54:31 You lazy fuck May 05 16:54:42 sas123: or now you can hopefully go over http://www.shlomifish.org/lecture/Perl/Newbies/lecture2/references/ or perlreftut or whatever. May 05 16:54:52 [09:51:28] I know how to do this, but is there a perl module that already does it for me? May 05 16:55:03 I doubt it May 05 16:55:04 rindolf: shall I ask my question May 05 16:55:08 sas123: yes. May 05 16:55:45 http://pastebin.com/d267d4fc0 May 05 16:56:01 In this how will %table look like May 05 16:56:31 <-- Getty has quit (heinlein.freenode.net irc.freenode.net) May 05 16:56:47 ? May 05 16:58:37 sas123: The paste d267d4fc0 has been copied to http://erxz.com/pb/8952 May 05 16:59:17 sas123: yes, please use http://sial.org/pbot/ or something. May 05 16:59:21 rindolf: u there? May 05 16:59:28 sas123: yes, I am. May 05 16:59:40 sas123: first of all add "use strict;" and "use warnings;" May 05 16:59:47 "use strict, Luke!" May 05 17:00:13 rindolf: that is old code May 05 17:00:45 rindolf: how will %table look like after while loop May 05 17:00:48 sas123: ah, so revamp it. May 05 17:01:03 sas123: you can't push into a string. May 05 17:01:12 sas123: $city will be a string. May 05 17:01:35 sas123: maybe you want my ($country, @cities) = split/:/, $_; May 05 17:01:47 rindolf: no May 05 17:01:55 sas123: is city a single value? May 05 17:02:00 Or is an array of values? May 05 17:02:05 Make up your mind. May 05 17:02:06 rindolf: data file is country:singele_city May 05 17:04:22 rindolf: ? May 05 17:05:16 rindolf: are you there? May 05 17:06:56 rindolf: ping May 05 17:07:49 sas123: hi. May 05 17:08:07 sas123: ah. May 05 17:08:11 jesus fucking christ iron man looks cool May 05 17:08:17 sas123: so why are you using push? May 05 17:09:40 data file format May 05 17:09:48 US:NYork May 05 17:09:55 US:NJ May 05 17:10:01 'UK:London May 05 17:10:04 sas123: yes, but you don't need to push the city if it's just one string. May 05 17:10:16 sas123: unless you want a one-element array. May 05 17:10:23 rindolf: no I need output like this May 05 17:10:28 sas123: have you heard of the 0, 1, Infinity rule? May 05 17:10:37 Ah. May 05 17:10:38 US:NYork,NJ May 05 17:10:40 I got you. May 05 17:10:46 UK:London May 05 17:10:57 sas123: just do push @{$table{$country}}, $city, and it will do the right thing. May 05 17:11:01 sas123: it's a DWIMMery. May 05 17:11:07 sas123: it's called auto-vivification. May 05 17:11:43 my question is after the while loop how will %table look like? May 05 17:12:02 sas123: it will look somethign liek: May 05 17:13:03 hoops May 05 17:13:07 buubot: eval: my %table = ('usa' => ["chicago", "newyork", "washington", "portland"], "israel" => ["telaviv", "j-m", "haifa", "nesher"], "uk" => ["london", "birmingham", "inverness"],); \%table May 05 17:13:08 rindolf: {uk => ["london","birmingham","inverness"],israel => ["telaviv","j-m","haifa","nesher"],usa => ["chicago","newyork","washington","portland"]} May 05 17:14:28 ok May 05 17:15:19 rindolf: Now I want a list of cities of USA from %table, how do I access it? May 05 17:15:25 --> Getty (i=torsten@metaluna4.de) has joined #perlcafe May 05 17:15:48 my $cities = $table{usa}; print "@$cities" May 05 17:15:56 sili++ May 05 17:16:21 sas123: the {bareword} notation gives you a string in Perl. May 05 17:16:40 You can do {'usa'} or {"usa"} to be on the safe side. May 05 17:16:56 There's also key => "Value". May 05 17:17:18 sili: I didn't get that May 05 17:17:28 sas123: which part? May 05 17:17:38 rindolf: how exactly? May 05 17:17:46 sas123: pardon? May 05 17:18:05 sili: my $cities = $table{usa}; print "@$cities" May 05 17:18:13 well May 05 17:18:15 sas123: OK. let's try it. May 05 17:18:16 why do we need my cities May 05 17:18:24 my $cities May 05 17:18:34 buubot: eval: my %table = ('usa' => ["chicago", "newyork", "washington", "portland"], "israel" => ["telaviv", "j-m", "haifa", "nesher"], "uk" => ["london", "birmingham", "inverness"],); [ $table{"uk"}->[0] ]; May 05 17:18:34 my is how we lexically declare variables May 05 17:18:35 rindolf: ["london"] May 05 17:18:57 rindolf: no no May 05 17:19:00 sas123: you should always use "use strict"; May 05 17:19:01 sas123: alternatively, you could just print "@{$cities{usa}}" May 05 17:19:07 rindolf: I want entire list May 05 17:19:24 buubot: eval: my %table = ('usa' => ["chicago", "newyork", "washington", "portland"], "israel" => ["telaviv", "j-m", "haifa", "nesher"], "uk" => ["london", "birmingham", "inverness"],); [ @{$table{"uk"}} ]; May 05 17:19:25 rindolf: ["london","birmingham","inverness"] May 05 17:19:34 buubot: eval: my %table = ('usa' => ["chicago", "newyork", "washington", "portland"], "israel" => ["telaviv", "j-m", "haifa", "nesher"], "uk" => ["london", "birmingham", "inverness"],); \@{$table{"uk"}} May 05 17:19:35 rindolf: ["london","birmingham","inverness"] May 05 17:19:42 Sorry for spamming the channel. May 05 17:19:53 rindolf: what does this mean in englisg @{$cities{usa}} May 05 17:20:00 OK. May 05 17:20:04 %cities is the hash. May 05 17:20:28 $cities{"usa"} is the value pointed by the string key "usa" of the hash %cities. May 05 17:20:44 And @{ .... } is dereferencing into an array. May 05 17:22:18 ok May 05 17:22:33 but confusing May 05 17:26:34 sas123: hmm... May 05 17:26:40 rindolf: how long are yu here? May 05 17:26:42 sas123: you get used to it. May 05 17:26:48 sas123: where? In #perlcafe ? May 05 17:26:59 sas123: or in Freenode? May 05 17:27:00 on irc May 05 17:27:16 sas123: I've been on IRC (not on Freenode though) since I was 17. May 05 17:27:25 Which was 14 or 15 years ago. May 05 17:27:30 But I took a long break. May 05 17:27:46 no I mean today, after this May 05 17:28:06 I have to go home, thee last bus goes in 10 mins May 05 17:28:20 sas123: ah. I'll be here. May 05 17:28:25 sas123: I'm going for a walk. May 05 17:28:33 sas123: how long does the bus take? May 05 17:28:46 sas123: anyway q[ender] can help you or whoever. May 05 17:28:50 1 hour May 05 17:29:03 sas123: ah, plenty of time for me to go on a walk. May 05 17:29:05 sas123: bye. May 05 17:29:29 great bye thank a lot May 05 17:29:40 sas123: bye. May 05 19:25:58 rindolf: are you back May 05 19:26:03 sas123: I'm here. May 05 19:26:10 sas123: been a while. May 05 19:26:23 sas123: I meant that I've been here for a while. May 05 19:26:34 My sister is now preparing Pretzels for my B-day. May 05 19:26:54 rindolf: still not working - I have an hash of country:(list of cities) May 05 19:27:11 sas123: please add "use strict" and "use warnings". May 05 19:27:17 sas123: you'll thank me for it. May 05 19:27:29 sas123: often when I look back at my old code, I also have to do many changes. May 05 19:27:29 rindolf: this does not print the list - print @{$table{"USA"}}, "\n"; May 05 19:27:34 sas123: that's life. May 05 19:27:45 sas123: is it "USA" or "usa"? May 05 19:28:09 USA May 05 19:29:02 rindolf: how young are you now? May 05 19:29:03 sas123: ok. May 05 19:29:05 rindolf: it iis just printing last value May 05 19:29:08 sili: I'm 31. May 05 19:29:33 cool May 05 19:29:41 sas123: then you're probably inputting it wrong. May 05 19:30:12 push @{$table{$country}}, $city; May 05 19:30:38 sas123: OK. May 05 19:30:45 sas123: do you know perl -d? May 05 19:30:53 sas123: or you can add traces. May 05 19:30:56 sas123: or logs. May 05 19:30:59 no May 05 19:31:03 perl -d would be the easiest. May 05 19:31:13 sas123: have you added strict and warnings? May 05 19:31:18 shall I paste the code May 05 19:31:31 sas123: sure to http://sial.org/pbot/ May 05 19:31:51 rindolf: No, I hate it - for me it has no meaning May 05 19:32:03 sas123: it's very important. May 05 19:32:11 sas123: they prevent many errors. May 05 19:32:25 rindolf: -w I might agree, but use strict SUCKS May 05 19:32:33 sas123: no, it does NOT. May 05 19:33:01 rindolf: it gives errors in Hebrew May 05 19:33:03 sas123: just use my. May 05 19:33:07 sas123: Hebrew? May 05 19:33:14 sas123: oh. May 05 19:33:20 sas123: you need to set your locale. May 05 19:33:27 sas123: LC_ALL=en_US.UTF-8 May 05 19:33:40 sas123: are you Israeli? May 05 19:33:42 hehehe May 05 19:33:42 sas123: ah. May 05 19:33:46 sas123: are you French? May 05 19:33:59 Because English people would say Greek. May 05 19:34:12 Indian May 05 19:34:20 While Israelis would say "Chinese" May 05 19:34:23 sas123: ah. May 05 19:34:33 sas123: Anyway, just set you LC_ALL. May 05 19:34:38 your I mean. May 05 19:35:14 incidentally I m as old as Shlomi Fish the author of http://www.shlomifish.org/ - the URL u gave May 05 19:35:14 Diablo-D3: overflow? May 05 19:35:21 sas123: ah. May 05 19:35:27 sas123: Shlomi Fish == me May 05 19:35:41 rindolf: What? May 05 19:35:42 sas123: it's my birthday today. May 05 19:35:45 sas123: I'm Shlomi Fish May 05 19:35:50 sas123: /whois rindolf rindolf May 05 19:35:58 sas123: and /msg NickServ INFO rindolf May 05 19:36:01 rindolf: I mean http://www.shlomifish.org May 05 19:36:16 sas123: yes, that's my homesite. May 05 19:36:27 rindolf: it is my b'day day after May 05 19:36:34 sas123: tomorrow? May 05 19:36:38 sas123: rindolf really is mr fish May 05 19:36:43 perlbot: paste May 05 19:36:43 Paste your code to http://sial.org/pbot/perl http://erxz.com/pb or http://p3m.org/pfn/perl and #Perl will be able to view it. May 05 19:36:49 rindolf: 7th May 05 19:36:53 sas123: ah. May 05 19:36:58 sas123: I was born on 5 May. May 05 19:37:04 sas123: so we're two days apart. May 05 19:37:16 My friend in School was born 6 or 7 days before me. May 05 19:37:16 :< May 05 19:37:18 wowww! happy b'day May 05 19:37:22 sas123: thanks. May 05 19:37:38 wtf no #perlcafe? May 05 19:37:50 there we go found one May 05 19:37:53 in the middle May 05 19:38:11 sas123: happy B-day to you too. May 05 19:39:53 Diablo-D3: isn't it in scalar context, something else. May 05 19:40:04 rindolf: http://sial.org/pbot/30963 May 05 19:40:06 $row is an array ref May 05 19:40:09 Diablo-D3: yes, but it may the number of elements in an array in scalar context. May 05 19:40:11 @$row is the array May 05 19:40:13 sas123: thanks. May 05 19:40:22 @$row[2] is the array element May 05 19:40:32 eval: my @array = (5); [@array+3] May 05 19:40:34 rindolf: [4] May 05 19:40:38 Diablo-D3: ^^^ May 05 19:40:49 that... means nothing to me May 05 19:41:02 sas123: looks fine. May 05 19:41:09 what s wrong? May 05 19:41:15 sas123: use perl -d May 05 19:41:29 sas123: read http://www.shlomifish.org/lecture/Perl/Newbies/lecture2/debugger/ May 05 19:41:30 how? May 05 19:42:26 Diablo-D3: it still bites me in many places. May 05 19:42:40 rindolf: do u want data file also May 05 19:42:43 Diablo-D3: first write it in a saner way. May 05 19:42:50 rindolf: whats wrong with it? May 05 19:42:55 its very sane May 05 19:43:01 sas123: sure,nopaste it too. May 05 19:47:10 rindolf: so why is it not working May 05 19:47:15 sas123: you should use chomp; May 05 19:47:40 sas123: and do «open (FS, "<", "data"); » May 05 19:47:50 I changed the code May 05 19:47:58 sas123: and I won't help you further unless you add use strict. May 05 19:48:00 rindolf: are you saying @$foo[1] is improper syntax? May 05 19:48:04 it is working now May 05 19:48:07 sas123: and neiteher would most other people. May 05 19:48:08 $foo[1] is not valid, there is no variable named @foo May 05 19:48:17 rindolf: no please have pity May 05 19:48:19 Diablo-D3: $foo->[1] May 05 19:48:21 :-) May 05 19:48:35 sas123: "The Gods help those that help themselves." May 05 19:48:43 sas123: "Reality to be conquered must be obeyed." May 05 19:48:48 rindolf: that seems a tad hacky May 05 19:49:06 sas123: "If the mountain doesn't come to Muhhamad, Muhhamad will go to the mountain." May 05 19:49:07 rindolf: use strict would have been compulosary if it was essential May 05 19:49:33 rindolf: at any rate, we're not supposed to be discussing what syntaxes perl accepts May 05 19:49:46 rindolf: we're supposed to be laughing because I discovered that google, like nintendo, prints money May 05 19:49:47 sas123: Perl 5 is backwards compatible to Perl 1, 2,3, and 4 which didn't have it. May 05 19:50:13 sas123: and Perl 1 was kinda hacky. May 05 19:50:15 rindolf: it makes learning perl moer difficult May 05 19:50:20 sas123: and didn't have lexical variables. May 05 19:50:26 sas123: yes, Perl 5 has evolved. May 05 19:50:45 sas123: but so did C, Pascal, Fortran, Lisp, and many other languages. May 05 19:50:46 rindolf: ? what r u taking about May 05 19:50:59 sas123: my ($s) is a lexical variable. May 05 19:51:10 sas123: what you are using are package-space variables. May 05 19:51:16 sas123: also known as globals. May 05 19:51:22 lexical ???????? May 05 19:51:28 sas123: yes. May 05 19:51:37 sas123: like in Scheme or ALGOL. May 05 19:51:42 what it means? May 05 19:52:07 sas123: http://www.shlomifish.org/lecture/Perl/Newbies/lecture2/my/