ok. this is going to take me a while to write up (i proof read lots, correct errors, and reword to make sure i get my message across exactly the way i need it to be).
apologies for not getting back to you until now. i've been with my sons all day today. currently, it's 1am, my time.
your words are rather humbling, and i feel intermediate, at best. believe it or not, though, i AM glad for this! thank you, kind sir!
i don't want to usurp your time, but ... clearly i lack knowledge (of terminology and syntax):
$foo[&bar] ? what's the &bar doin in there? isn't that a subroutine? :s
or is & a variable type like $? no, right? i've done tons of programming in my life. i really enjoy perl coding - it's fun as carnivals. but, perl seems....odd somehow.
does @foo[0] return different data than $foo[0] ? or, is it just sloppy somehow? if so, how? is $foo[$i] 'bad'?
are these all the same var?
@data
$data
&data
how do i make a filehandle lexical? like this? i read somewhere this was how to make things lexical:
-
{
-
if open F, "<", "data.txt" {
-
close F;
-
} else {
-
print "<b>eek!</b> opening data.txt for reading failed: $!<br>\n";
-
}
-
}
-
i see what yer sayin about the getparam function. it'll get deprecated shortly. i just wanted to shorten the length of that command. $cgi->param('data') is much harder to type than getparam('data');
gosh. no clue what "at -e line 1 (#1) (W syntax)" means. blink blink
i check if files exist prior to nearly all open commands. so i can redirect, or display errors messages. i try to do most error checks before getting into the "meat" of the code.
in some cases, i do this, instead of die (die is kinda ugly):
-
if (open F, '<', "data.txt") {
-
#
-
# success code here
-
#
-
close F:
-
} else {
-
#
-
# display error msg with $!
-
#
-
}
-
looks nicer, and allows me to control the output of the error msg, whereas die just kills the whole works, and its output (although very useful) is ... abrupt, and lacks aesthetics.
also, inserting the above code into an already two or three layer nested if structure is cumbersome, is prone to bugs, and can get confusing. so i do my best to check before hand and make my error messages look better, instead of looking like it was interrupted due to bad coding (from a user perspective; this might make them feel uneasy about the site).
i don't like that i can't declare an array size (eg: my @array[0..23];) like you can in most other languages. well, i guess i could. my $array = ['', '', '', ''.......]; but that seems awful somehow. I guess i'm just not sure when to use $ or @.
Dancer2? MVC Framwork? arrooo?? i only use CGI sparingly. just for the params thing. i have no ideas on how to use CGI further than that in my scripts. probably won't need to.
i've come across pragma before. never really looked into it...is it critical i learn that here?
um, what else? oh ya! i want to remove ALL occurences of \n (and/or \r). this way, regex matching elsewhere works. also, i don't want to have \n or \r in $filename or in an array element, for instance. and, what if it's not \r\n but \n\r ?? lol. i tend to remove one, then the other.
you see, i'm pretty particular how my data is stored, and retrieved. i need to make sure it's all formatted basically the same. if not, odd things can happen in the HTML output. i don't use those functions which do HTML for me. I hand code that part myself. i incorporate pretty printing into the html output. a random \n can wreak havoc in the wrong place (not just for the pretty printing, but it can SOMETIMES break the HTML, too).
not sure why i haven't used push. why is it more appropriate than the way i add elements to an array? most of my arrays are small, and just plain text. nothing too complicated about them. i haven't even delved into hashes yet. well, i've dipped my toe, so to speak. read some things. kinda neat. might work nice for storing info from my data.txt files.
i've got some learning, and a bunch of recoding to do.
thanks again, Ron, for your time, and expertise!
it's now almost 230. got that done faster than i thought.