Anti-nuisance lawsuit warning: The purpose of these notes is to remind me, Zoegond, of stuff or to help me work stuff out. They may contain mistakes.

Quick

  • ($a, $b....) = unpack("A2A7...", $packed)
  • push( array, list )

Tuesday, July 30, 2013

Perl split

split doesn't return empty string items for trailing delimiters - split(/;/, "a;;;") returns just 1 item, "a".

Similarly in the degenerate case where the string consists entirely of delimiters, no items are returned at all.

Leading delimiters, on the other hand, generate empty items as you'd expect. split(/;/, ";;a") returns 3 items - ("", "", "a").

Tuesday, July 23, 2013

Subquery field qualifiers

With Sybase you could say

insert into t2(f1)
select f1
from t1
where not exists (select * from t2 where t2.f1 = f1)

and have the unqualified f1 in the subquery interpreted as being f1.t1 (the useful interpretation).

SQL Server does not do this, it takes it to be t2.f1 (the useless interpretation).

So always qualify both references to f1 in subqueries like this.

Followers

Blog Archive