In reply to samirxd:
##0 is sequence concatenation indicating the beginning of the second sequence is in the same clock tick as the end of the first sequence. Since these are both single clock sequences, they are concurrently true .There is no implied ordering between the sequence match items. However within a list, the statements get executed in the order they appear. So you should write this as:
property test;
int y, w;
a |->
(1, y=q, $display("%t sampled q=%d, current q=%d, past q=%d, var y=%d", $time, $sampled(q), q, $past(q), y),
w=getq(), $display("%t sampled q=%d, current q=%d, past q=%d, var w=%d", $time, $sampled(q), q, $past(q), w));
endproperty