2 Replies - 1228 Views - Last Post: 05 March 2015 - 03:10 PM

#1 Kreshnic  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 21
  • Joined: 13-June 12

Double Parentheses in Perl

Posted 04 March 2015 - 10:58 AM

I am brand new to the Perl language and am looking for any information that will help. One of the things I see is an If statement like this:
if( ($cipher) ){
$ciphertext = $chipher->encrypt($text);
}



I understand this is an encryption specific statement but am curious why there is the double Parens in the if statement? From what I understand it should give higher importance to the content in the second set of parens, but since there is only content in the second set of parens, what exactly is it doing if anything?

Is This A Good Question/Topic? 0
  • +

Replies To: Double Parentheses in Perl

#2 no2pencil  Icon User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6544
  • View blog
  • Posts: 30,650
  • Joined: 10-May 07

Re: Double Parentheses in Perl

Posted 04 March 2015 - 12:46 PM

A quick Google search tells me that if there are parens in the variable, then the variable needs to be between a set of parens. The outer set of parens is likely for the if conditional statement.
Was This Post Helpful? 0
  • +
  • -

#3 Kreshnic  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 21
  • Joined: 13-June 12

Re: Double Parentheses in Perl

Posted 05 March 2015 - 03:10 PM

so if the information contained in the variable has parens then? the variable itself is $cipher, that was why I was confused about the second set of parens.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1