Array Subexpression Operator (@)

The PowerShell array subexpression character (@) is also used in Perforce revision specifications. There is no ambiguity when this character is embedded in another string. For example,

PS D:\workspaces> p4 files //....@2

is passed to p4 as desired.

A problem arises when the @ character is the first character of a token. For example,

PS D:\workspaces> p4 files @2,@4

results in:

Unrecognized token in source text.
At line:1 char:10
+ p4 files @ <<<< 2,@4

This is because PowerShell attempts to parse the characters following the @ as an array subexpression.

This can be easily addressed by quoting the @ characters. For example,

PS D:\workspaces> p4 files `@2,`@4
PS D:\workspaces> p4 files "@2,@4"
PS D:\workspaces> p4 files '@2,@4'

all work as desired.