http://www.perlmonks.org?node_id=960906


in reply to Re^2: Compare Inventory to Database and Vice-Versa
in thread Compare Inventory to Database and Vice-Versa

If you've written it in VBA then rewriting in Perl should be a snap! Perl has much better, well everything really, than VBA, but especially string manipulation, control structures and data structures. You'll find Perl is much closer to C++ in many ways than to VBA.

As I said earlier, hashes are the key. Think STL's map class.

For standard sorts of stuff Perl is very portable. For what you have described so far you should be able to move your *nix script to a Windows box unchanged. Note that Perl will even "do the right thing" with native line endings so on *nix it uses line feeds and on Windows carriage return line feed pairs when reading and writing files by default. A \n used in regular expressions and string turns into the correct thing for the native OS.

I suggest you whip up some code than come back for a little criticism. Oh, and always use strictures (use strict; use warnings; - see The strictures, according to Seuss) ;).

True laziness is hard work
  • Comment on Re^3: Compare Inventory to Database and Vice-Versa

Replies are listed 'Best First'.
Re^4: Compare Inventory to Database and Vice-Versa
by Hellhound4 (Novice) on Mar 22, 2012 at 02:02 UTC
    I agree. I'm working on some right now. Can you point me toward some good references for syntax of loops. Hashes seem to be covered well in the tutorial section. Also I am new here so should I add a reply with code or update my original post? And how do I flag?

      I'd be inclined to post a new question with code and questions focused on that code.

      perlsyn is the place to look for control structure syntax. Don't be seduced into using C++'s for loop, use Perl's for my $element (@list) loop instead. 'next' and 'last' are 'continue' and 'break', but look at 'redo' too.

      Pay special attention to the Perl operators. Mostly they look familiar to a C++ user, but there are a few extra that are worth knowing about and some of them do special magic of a mind reading nature.

      If you have time take a look at map and grep. In any case you must at least skim perlretut. If you plan to stick with Perl for the long haul get a copy of the "Perl Pocket Reference". I wore my first copy out!

      True laziness is hard work