in reply to Calling Stored procedure from perl

qq is simply another means of double quoting a string. See perlop for full details on qq and its sibbling operators.

eg.
my $var = 'blue'; my $string1 = "the sky is $var\n"; my $string2 = qq|the sky is $var\n|;
Both string1 and string2 are identical. The qq operator usually gets used when you need the " character within the string itself, and allows you to avoid having to escape it with a \.

eg.
my $var = 'blue'; my $string1 = "the \"sky\" is $var\n"; my $string2 = qq|the "sky" is $var\n|;
Both string1 and string2 are still identical.

Replies are listed 'Best First'.
Re^2: Calling Stored procedure from perl
by mtrasp (Acolyte) on Mar 02, 2010 at 05:44 UTC

    Thank you very much for your reply. can u please tell me what is happening here and what i need to learn to understand below code.

    my $sql = qq|$strStoredProc $strArg|; if ($mydb->Sql($sql)) { Win32::ODBC::DumpError(); } if ($mydb->FetchRow()) { %DataSet = $mydb->DataHash(); $strResultValue = $DataSet{$strResultField}; } else { writelog(info,"No row found for $strResultField"); $mydb->Close(); } $mydb->Close();
      Take a look through perldoc Win32::ODBC this will introduce the concepts you need to follow this code and define the methods used in your snippet.

      Essentially it creates a string of the stored procedure and argument(s) and then makes a single row selection from the results of this procedure which it returns as a hash and checks for a value in the field specified in the variable $strResultField

      In this specific caseExecStoredProcedureArg1("pr_CustomForPV",  "$VersionID,$AutoNumber", "IsCustom") it runs the pr_CustomForPV procedure with the values in $VersionID and $AutoNumber and checks to see if the IsCustom field is set

      print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."