<image>(2011 Autumn•Foreign Language District Monthly Exam) As shown in the image, a farm plans to build two rectangular sheep pens, with one side of each pen against an existing wall (which is long enough), and the remaining sides fenced with wooden poles. The total length of the fence is 18 meters, and the total area is y square meters. Let one side of each pen be x meters (as shown in the image).
(1) Find the function expression of y in terms of x and the range of the variable x;
(2) When y = 27 square meters, the length of the pen is ____ meters.