Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
There are two questions I was unsure of and I was wondering if someone could explain them to me. I saved the few I was guessing on.
This one I got wrong as I expected it to print "Hello World". Instead it prints "1". Can someone explain this phenomonon to me? It's not s///, it's m//, right? So why is $data altered?my $data = "Hello World" =~ /(.*) (.*)/; print "$data\n";
I said it begins when the script encounters the BEGIN statement. It was either between this one or during compilation. Can anyone help me out with this one?When does a BEGIN block execute?
20040708 Edit by ysth: Add readmore tags to keep spoilers off front-page
|
|---|